| | |
| | | using WIDESEA.Services.IServices.ToApp; |
| | | using WIDESEA.Services.Repositories; |
| | | using WIDESEA.Services.Services; |
| | | using WIDESEA_Common.LogEnum; |
| | | using WIDESEA_Entity.DomainModels; |
| | | |
| | | |
| | |
| | | |
| | | // æ åå¼ |
| | | string Standard_value = saveModel.MainData["Standard_value"].ToString(); |
| | | |
| | | // äº§å° |
| | | string Placeoforigin = saveModel.MainData["Placeoforigin"].ToString(); |
| | | |
| | | if (string.IsNullOrEmpty(madeUnit) || string.IsNullOrEmpty(materielId) || string.IsNullOrEmpty(materielType) || string.IsNullOrEmpty(NewOrOld)) |
| | | throw new Exception($"åå®¶/轮对/åå·/æ£ä¿®ç±»åé½ä¸è½ä¸ºç©º"); |
| | |
| | | if (dt_EmptyPallet == null) |
| | | throw new Exception($"æçç :ã{rfid}ã,卿ç管çä¸ï¼æ 该æçï¼è¯·å
æ·»å æçä¿¡æ¯"); |
| | | |
| | | |
| | | |
| | | |
| | | //å¤æè½´æ¿ææææ¯å¦è¶
è¿2å¹´ |
| | | if (DateTime.Now > Convert.ToDateTime(ProductDate).AddYears(2)) |
| | |
| | | newBoxDetail.boxdtl_materielid = materielId; |
| | | newBoxDetail.boxdtl_qty = "1"; |
| | | newBoxDetail.boxdtl_operator = UserContext.Current.UserTrueName; |
| | | newBoxDetail.boxdtl_inboundUnit = "æºç²¤"; |
| | | newBoxDetail.boxdtl_inboundUnit = "å京å¨è½¦æ®µ"; |
| | | newBoxDetail.boxdtl_standard = NewOrOld; |
| | | newBoxDetail.boxdtl_carType = materielId; |
| | | newBoxDetail.boxdtl_type = materielType; |
| | |
| | | newBoxDetail.boxdtl_text2 = LotNumber; |
| | | newBoxDetail.boxdtl_text3 = ProductDate; |
| | | |
| | | Dt_boxing_headRepository.Instance.Add(newBoxHead, true); |
| | | Dt_boxing_detailRepository.Instance.Add(newBoxDetail, true); |
| | | |
| | | |
| | | |
| | | Dt_mes_goods_info info = new Dt_mes_goods_info(); |
| | | info.mesInfo_id = Guid.NewGuid(); |
| | | info.mesInfo_inUnit = "æºç²¤"; |
| | | info.mesInfo_inUnit = "å京å¨è½¦æ®µ"; |
| | | info.mesInfo_madeUnit = madeUnit; |
| | | info.mesInfo_carType = materielId; |
| | | info.mesInfo_type = materielType; |
| | |
| | | info.mesInfo_qrCode = qrCode; |
| | | info.mesInfo_createDate = DateTime.Now; |
| | | info.mesInfo_bak_3 = Standard_value; // ä»¥åæ åå¼ä»è¿éè·å èä½¼æ°å¢ |
| | | |
| | | Dt_mes_goods_infoRepository.Instance.Add(info, true); |
| | | |
| | | |
| | | info.mesInfo_bak_4 = Placeoforigin; // è½´æ¿çäº§å° |
| | | |
| | | |
| | | //è·åç©ºè´§ä½ |
| | | Dt_locationinfo emptyLocation = CommonFunction.GetEmptyLocationAction(); |
| | | Dt_locationinfo emptyLocation; |
| | | |
| | | int maxRetries = 20; |
| | | int retryCount = 0; |
| | | bool needRetry; |
| | | do |
| | | { |
| | | needRetry = false; // é»è®¤ä¸éè¦éè¯ |
| | | retryCount++; |
| | | |
| | | //è·åç©ºè´§ä½ |
| | | emptyLocation = CommonFunction.GetEmptyLocationAction(1); |
| | | if (emptyLocation == null) |
| | | { |
| | | return content.Error("æ æ³è·ååºä½"); |
| | | } |
| | | |
| | | // 2. æ£æ¥åºå |
| | | if (IsEmptyPalletLocation(emptyLocation.location_id)) |
| | | { |
| | | needRetry = true; |
| | | continue; // ç´æ¥è¿å
¥ä¸ä¸æ¬¡å¾ªç¯ï¼éè¯ï¼ |
| | | } |
| | | |
| | | // 3. æ£æ¥ä»»å¡ |
| | | if (Dt_taskinfoRepository.Instance.Find(x => x.task_endstation == emptyLocation.location_id).FirstOrDefault() != null) |
| | | { |
| | | needRetry = true; |
| | | continue; |
| | | } |
| | | |
| | | } while (needRetry && retryCount < maxRetries); |
| | | // æ£æ¥æ¯å¦è¶
è¿æå¤§éè¯æ¬¡æ° |
| | | if (retryCount >= maxRetries) |
| | | { |
| | | return content.Error($"æ æ³æ¾å°å¯ç¨åºä½ï¼å·²å°è¯ {retryCount} 次ï¼"); |
| | | } |
| | | |
| | | |
| | | |
| | | Dt_boxing_headRepository.Instance.Add(newBoxHead, true); |
| | | Dt_boxing_detailRepository.Instance.Add(newBoxDetail, true); |
| | | Dt_mes_goods_infoRepository.Instance.Add(info, true); |
| | | |
| | | //è·åä»»å¡ |
| | | Dt_taskinfo tmpTaskInfo = CommonFunction.AddWMSTask_BoxPalletIn(emptyLocation, rfid, materielId, qrCode, materielType); |
| | | //ä¿®æ¹è´§ä½ç¶æ |
| | |
| | | Logger.AddLog(LoggerType.Add, saveModel, content, content); |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ£æ¥æå®è´§ä½æ¯å¦ä¸ºç©ºæçè´§ä½ |
| | | /// </summary> |
| | | /// <param name="locationId">è´§ä½ID</param> |
| | | /// <returns>true: æ¯ç©ºæçè´§ä½, false: 䏿¯ç©ºæçè´§ä½</returns> |
| | | public bool IsEmptyPalletLocation(string locationId) |
| | | { |
| | | try |
| | | { |
| | | // æ¥è¯¢ç©ºæçè´§ä½ä¿¡æ¯ |
| | | var emptyPalletLocation = VV_ContainerInfo_EmptyPalletRepository.Instance |
| | | .Find(x => x.location_id == locationId).FirstOrDefault(); |
| | | |
| | | // æ¥è¯¢è´§ä½ä¸ç容å¨ä¿¡æ¯ |
| | | var containerInfo = VV_ContainerInfoRepository.Instance |
| | | .Find(x => x.location_id == locationId).FirstOrDefault(); |
| | | |
| | | bool isEmptyPallet = emptyPalletLocation != null || containerInfo != null; |
| | | |
| | | return isEmptyPallet; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogRecord.WriteLog((int)LogEnum.Errer, $"æ£æ¥ç©ºæçè´§ä½å¤±è´¥ï¼è´§ä½IDï¼{locationId}ï¼é误ï¼{ex.Message}"); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |