| | |
| | | using Newtonsoft.Json; |
| | | using NPOI.HPSF; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Globalization; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using WIDESEA.Common; |
| | | using WIDESEA.Core.BaseProvider; |
| | | using WIDESEA.Core.Extensions; |
| | | using WIDESEA.Core.ManageUser; |
| | | using WIDESEA.Core.Services; |
| | |
| | | { |
| | | public partial class CommonFunction |
| | | { |
| | | |
| | | /// <summary> |
| | | /// è½´æ¿åºåº |
| | | /// </summary> |
| | |
| | | |
| | | foreach (var item in materielinfo) |
| | | { |
| | | // List<VV_ContainerInfo> listContainer = VV_ContainerInfoRepository.Instance.Find(r => !r.location_islocked |
| | | // && r.location_state == LocationState.LocationState_Stored.ToString() && r.containerdtl_madeUnit == Manufacturer |
| | | //&& r.containerdtl_standard.Contains(zcState) && r.materiel_id == item.materiel_id && r.containerdtl_standardResult == 1 |
| | | // && (string.IsNullOrEmpty(r.csize_out_result) || r.csize_out_result == "åæ ¼") && r.containerdtl_qualityCheck == true |
| | | // && r.containerdtl_takeGoogsCheck == true); |
| | | |
| | | List<VV_ContainerInfo> listContainer = VV_ContainerInfoRepository.Instance.Find(r => !r.location_islocked |
| | | && r.location_state == LocationState.LocationState_Stored.ToString() && r.containerdtl_madeUnit == Manufacturer |
| | | && r.containerdtl_standard.Contains(zcState) && r.materiel_id == item.materiel_id && r.containerdtl_standardResult == 1 |
| | | && (string.IsNullOrEmpty(r.csize_out_result) || r.csize_out_result == "åæ ¼") && r.containerdtl_qualityCheck == true |
| | | && r.containerdtl_takeGoogsCheck == true); |
| | | && r.containerdtl_standard.Contains(zcState) && r.materiel_id == materiel && r.containerdtl_standardResult == 1 |
| | | && (string.IsNullOrEmpty(r.csize_out_result) || r.csize_out_result == "åæ ¼")); |
| | | |
| | | //listContainer = listContainer.OrderBy(x => DateTime.ParseExact(x.containerdtl_ProductDate,"yyyy-MM-dd",CultureInfo.InvariantCulture)).ToList(); |
| | | |
| | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æå¨éé
|
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public static WebResponseContent Manual_configuration(SaveModel saveModel) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //轮对æ¡ç |
| | | string barcode = saveModel.MainData["barcode"].ToString(); |
| | | //车å |
| | | string materiel = saveModel.MainData["materiel"].ToString(); |
| | | //è½´æ¿ç¶ææ°æ§ |
| | | string zcState = saveModel.MainData["zcState"].ToString(); |
| | | //è½´æ¿åå®¶ |
| | | string Manufacturer = saveModel.MainData["Manufacturer"].ToString(); |
| | | //å³é²å°æ¿ |
| | | string yfcbAVG = saveModel.MainData["yfcbAVG"]?.ToString(); |
| | | //å·¦é²å°æ¿ |
| | | string zfcbAVG = saveModel.MainData["zfcbAVG"]?.ToString(); |
| | | //左油档 |
| | | string zydAVG = saveModel.MainData["zydAVG"]?.ToString(); |
| | | //峿²¹æ¡£ |
| | | string yydAVG = saveModel.MainData["yydAVG"]?.ToString(); |
| | | //å·¦è½´å¾ |
| | | string zzjAVG = saveModel.MainData["zzjAVG"]?.ToString(); |
| | | //å³è½´å¾ |
| | | string yzjAVG = saveModel.MainData["yzjAVG"]?.ToString(); |
| | | //å¼å«å·¥ä½ |
| | | string targetStation = saveModel.MainData["targetStation"].ToString(); |
| | | //è½´æ¿æ¹å |
| | | string ZCdirection = saveModel.MainData["ZCdirection"].ToString(); |
| | | |
| | | //è½®å¯¹å· |
| | | string ldCode = saveModel.MainData["ldCode"].ToString(); |
| | | |
| | | // åæ¡£å
å¾å¼ |
| | | string csize_four_3 = saveModel.MainData["csize_four_3"].ToString(); |
| | | // åæ¡£å
å¾ç»æ |
| | | string csize_four_result = saveModel.MainData["csize_four_result"].ToString(); |
| | | // è½´æ¿å
å¾å¼ |
| | | string csize_in_value = saveModel.MainData["csize_in_value"].ToString(); |
| | | // è½´æ¿å
å¾ç»æ |
| | | string csize_in_result = saveModel.MainData["csize_in_result"].ToString(); |
| | | // è½´æ¿ç¼ç |
| | | string Bearing_code = saveModel.MainData["Bearing_code"].ToString(); |
| | | |
| | | // è·åè½´æ¿è¯¦æ
æ°æ®åæµéçæ°æ® |
| | | Dt_container_size_info_hty size_info_hty = Dt_container_size_info_htyRepository.Instance.Find(x => x.csize_barcode == Bearing_code).ToList().LastOrDefault(); |
| | | Dt_container_detail_hty detail_hty = Dt_container_detail_htyRepository.Instance.Find(x => x.containerdtl_goodsCode == Bearing_code).ToList().LastOrDefault(); |
| | | |
| | | // æç»çç»æ |
| | | bool Flag = false; |
| | | |
| | | //å·¦åºåºè½´æ¿ |
| | | VV_ContainerInfo leftContainer = null; |
| | | //å³åºåºè½´æ¿ |
| | | VV_ContainerInfo rightContainer = null; |
| | | List<Dt_materielinfo> materielinfo = Dt_materielinfoRepository.Instance.Find(r => r.materiel_suitMateriel.Contains(materiel)); |
| | | |
| | | |
| | | //è·åéé
æ å |
| | | List<Dt_selection_standards> listStandard = null; |
| | | foreach (var item in materielinfo) |
| | | { |
| | | listStandard = Dt_selection_standardsRepository.Instance.Find(r => r.selection_carId == item.materiel_id |
| | | && r.selection_zc_manufacturer == Manufacturer && r.selection_zc_type.Contains(zcState)); |
| | | if (null != listStandard && listStandard.Count > 0) |
| | | break; |
| | | } |
| | | |
| | | if (listStandard.Count > 0 && listStandard != null) |
| | | { |
| | | |
| | | if (!(detail_hty.containerdtl_standardResult == 1)) |
| | | { |
| | | return content.Error("ç§°éç»æä¸æ£å¸¸ ä¸è½è¿è¡æå¨éé
"); |
| | | } |
| | | |
| | | if (!(detail_hty.containerdtl_materielid == materiel)) |
| | | { |
| | | return content.Error("车åä¸ä¸è´ ä¸è½è¿è¡æå¨éé
"); |
| | | } |
| | | |
| | | if (!(detail_hty.containerdtl_madeUnit == Manufacturer)) |
| | | { |
| | | return content.Error("åå®¶ä¸ä¸è´ ä¸è½è¿è¡æå¨éé
"); |
| | | } |
| | | |
| | | if (!(detail_hty.containerdtl_standard.Contains(zcState))) |
| | | { |
| | | return content.Error("è½´æ¿æ°æ§ç¶æä¸ä¸è´ ä¸è½è¿è¡æå¨éé
"); |
| | | } |
| | | |
| | | if ("left".Equals(ZCdirection)) |
| | | { |
| | | string left_result = GetContainer2(listStandard, size_info_hty, zzjAVG, zfcbAVG, zydAVG, "left"); |
| | | if (left_result == "True") |
| | | { |
| | | Flag = true; |
| | | } |
| | | } |
| | | else if ("right".Equals(ZCdirection)) |
| | | { |
| | | string right_result = GetContainer2(listStandard, size_info_hty, yzjAVG, yfcbAVG, yydAVG, "right"); |
| | | if (right_result == "True") |
| | | { |
| | | Flag = true; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content.Error("没æéé
æ å ä¸è½è¿è¡æå¨éé
"); |
| | | } |
| | | |
| | | if ("all".Equal(ZCdirection)) |
| | | { |
| | | if (null == leftContainer || null == rightContainer) |
| | | return content.Error("æªæ¾å°å¯å¹é
çåºåºè½´æ¿,车åï¼" + materiel); |
| | | } |
| | | |
| | | if (Flag) |
| | | { |
| | | if ("left".Equals(ZCdirection)) |
| | | { |
| | | CommonFunction.GetZCInfo2(size_info_hty, detail_hty, materiel, barcode, zfcbAVG, zydAVG, zzjAVG, ldCode, targetStation, "left", materiel); |
| | | } |
| | | |
| | | if ("right".Equals(ZCdirection)) |
| | | { |
| | | CommonFunction.GetZCInfo2(size_info_hty, detail_hty, materiel, barcode, zfcbAVG, zydAVG, zzjAVG, ldCode, targetStation, "right", materiel); |
| | | } |
| | | |
| | | content.OK($"è½´æ¿éé
æåï¼å¯ä»¥è¿è¡åè£
"); |
| | | } |
| | | else |
| | | return content.Error("æªæ¾å°å¯¹åºç车åæè
æ°æ®è®¡ç®é误 ä¸è½è¿è¡éé
以ååè£
"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error("å建æå¨éé
失败:" + ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | LogRecord.WriteLog((int)LogEnum.OutBound, $"{UserContext.Current.UserTrueName}è½´æ¿éé
åºåºï¼åæ°:{saveModel.Serialize()},è¿ååæ°:{content.Serialize()}"); |
| | | } |
| | | return content; |
| | | } |
| | | private static Dt_taskinfo GetOutboundTask(VV_ContainerInfo container, string target, string direction, object zcInfo) |
| | | { |
| | | Dt_locationinfo locationinfo = Dt_locationinfoRepository.Instance.FindFirst(x => x.location_id == container.location_id); |
| | |
| | | queryble = queryble.Where(r => r.csize_four_result != "ä¸åæ ¼"); |
| | | |
| | | ////油档 |
| | | Dt_selection_standards ydStand = listStand.Find(r => r.selection_standard_type == "3"); |
| | | if (null != ydStand) |
| | | { |
| | | if (!string.IsNullOrEmpty(ydAVG)) |
| | | { |
| | | //ä¸é |
| | | decimal ydStandQty_positive = ydStand.selection_positive_value.GetValueOrDefault(); |
| | | //ä¸é |
| | | decimal ydStandQty_negative = ydStand.selection_negative_value.GetValueOrDefault(); |
| | | decimal mesStand = decimal.Parse(ydAVG); |
| | | queryble = queryble.Where(r => r.csize_three_result == "åæ ¼" && (mesStand - decimal.Parse(r.csize_three_3)) >= ydStandQty_negative |
| | | && mesStand - (decimal.Parse(r.csize_three_3)) <= ydStandQty_positive); |
| | | } |
| | | else |
| | | queryble = queryble.Where(r => r.csize_three_result != "ä¸åæ ¼"); |
| | | } |
| | | else |
| | | queryble = queryble.Where(r => r.csize_three_result != "ä¸åæ ¼"); |
| | | //Dt_selection_standards ydStand = listStand.Find(r => r.selection_standard_type == "3"); |
| | | //if (null != ydStand) |
| | | //{ |
| | | // if (!string.IsNullOrEmpty(ydAVG)) |
| | | // { |
| | | // //ä¸é |
| | | // decimal ydStandQty_positive = ydStand.selection_positive_value.GetValueOrDefault(); |
| | | // //ä¸é |
| | | // decimal ydStandQty_negative = ydStand.selection_negative_value.GetValueOrDefault(); |
| | | // decimal mesStand = decimal.Parse(ydAVG); |
| | | // queryble = queryble.Where(r => r.csize_three_result == "åæ ¼" && (mesStand - decimal.Parse(r.csize_three_3)) >= ydStandQty_negative |
| | | // && mesStand - (decimal.Parse(r.csize_three_3)) <= ydStandQty_positive); |
| | | // } |
| | | // else |
| | | // queryble = queryble.Where(r => r.csize_three_result != "ä¸åæ ¼"); |
| | | //} |
| | | //else |
| | | // queryble = queryble.Where(r => r.csize_three_result != "ä¸åæ ¼"); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | return queryble.OrderBy(r => r.containerdtl_ProductDate).ThenBy(r => r.containerdtl_createtime).FirstOrDefault(); |
| | | } |
| | | public static string GetContainer2(List<Dt_selection_standards> listStand, Dt_container_size_info_hty size_info_hty, |
| | | string zjAVG, string fcbAVG, string ydAVG, string direction) |
| | | { |
| | | //IQueryable<VV_ContainerInfo> queryble = listContainer.AsQueryable(); |
| | | |
| | | //è½´æ¿å
å¾ |
| | | |
| | | Dt_selection_standards zjStand = listStand.Find(r => r.selection_standard_type == "1"); |
| | | if (null != zjStand) |
| | | { |
| | | if (!string.IsNullOrEmpty(zjAVG)) |
| | | { |
| | | //ä¸é |
| | | decimal zjStandQty_positive = zjStand.selection_positive_value.GetValueOrDefault(); |
| | | //ä¸é |
| | | decimal zjStandQty_negative = zjStand.selection_negative_value.GetValueOrDefault(); |
| | | decimal mesStand = decimal.Parse(zjAVG); |
| | | bool flag = size_info_hty.csize_in_result == "åæ ¼" && mesStand - (decimal.Parse(size_info_hty.csize_in_value)) >= zjStandQty_negative |
| | | && mesStand - (decimal.Parse(size_info_hty.csize_in_value)) <= zjStandQty_positive; |
| | | if (!flag) |
| | | { |
| | | return direction + "çæ¹å è½´æ¿å
å¾ è¿çéä¸ç¬¦å å¼ä¸º," + (mesStand - (decimal.Parse(size_info_hty.csize_in_value))).ToString(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | ////é²å°æ¿ |
| | | Dt_selection_standards fcbStand = listStand.Find(r => r.selection_standard_type == "2"); |
| | | if (null != fcbStand) |
| | | { |
| | | |
| | | if (!string.IsNullOrEmpty(fcbAVG)) |
| | | { |
| | | //ä¸é |
| | | decimal fcbStandQty_positive = fcbStand.selection_positive_value.GetValueOrDefault(); |
| | | //ä¸é |
| | | decimal fcbStandQty_negative = fcbStand.selection_negative_value.GetValueOrDefault(); |
| | | decimal mesStand = decimal.Parse(fcbAVG); |
| | | |
| | | bool flag = size_info_hty.csize_four_result == "åæ ¼" && mesStand - (decimal.Parse(size_info_hty.csize_four_3)) >= fcbStandQty_negative |
| | | && mesStand - (decimal.Parse(size_info_hty.csize_four_3)) <= fcbStandQty_positive; |
| | | if (!flag) |
| | | { |
| | | return direction + "çæ¹å é²å°æ¿ è¿çéä¸ç¬¦å å¼ä¸º," + (mesStand - (decimal.Parse(size_info_hty.csize_four_3))).ToString(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return "True"; |
| | | } |
| | | |
| | | |
| | | } |