public void ToRight(object obj) { if (LeftIndex.Equals(-1)) { return; } int index = LeftIndex; Model.BlankingRecordLeftModel.DataModel model = LeftData[LeftIndex]; LeftData.RemoveAt(LeftIndex); if (!LeftData.Count.Equals(0)) { LeftIndex = index >= LeftData.Count ? (LeftData.Count - 1) : index; } blankingRecordBLL.GetUpdateBlankingRecordLeftResult(ICode, BCode, model.ID); RightData.Add(new Model.BlankingRecordRightModel.DataModel() { ID = model.ID, BiankingSize = model.BiankingSize }); }
//******************************************************************************************************************// public void LoadData() { if (StoreInfoModel.MaterialInfo.GetMaterialDetail.IsZhuDuanJian) { if (StoreInfoModel.MaterialInfo.GetPart == null) { throw new Exception("本体为铸件锻件,但是在part表查不到信息!"); } if (StoreInfoModel.MaterialInfo.GetMaterialDetail.PartAlreadyScanQuantity < StoreInfoModel.MaterialInfo.GetMaterialDetail.PartQuantity) { LeftData.Add(new MaterialScanModel() { PartCode = StoreInfoModel.MaterialInfo.GetPart.InventoryCode ?? "", PartFigureCode = StoreInfoModel.MaterialInfo.GetPart.Model ?? "", BarCode = StoreInfoModel.MaterialInfo.GetPart.CorrespondingBarcode ?? "", DemandScanQuantity = StoreInfoModel.MaterialInfo.GetMaterialDetail.PartQuantity - StoreInfoModel.MaterialInfo.GetMaterialDetail.PartAlreadyScanQuantity, IsCrux = StoreInfoModel.MaterialInfo.GetProcessBom.IsCrux ?? 0 }); } else { CenterData.Add(new MaterialScanModel() { PartCode = StoreInfoModel.MaterialInfo.GetPart.InventoryCode ?? "", PartFigureCode = StoreInfoModel.MaterialInfo.GetPart.Model ?? "", BarCode = StoreInfoModel.MaterialInfo.GetPart.CorrespondingBarcode ?? "", IsCrux = StoreInfoModel.MaterialInfo.GetProcessBom.IsCrux ?? 0 }); } } foreach (var item in StoreInfoModel.MaterialChildInfos) { if (item.GetMaterialDetail.PartAlreadyScanQuantity < item.GetMaterialDetail.PartQuantity) { LeftData.Add(new MaterialScanModel() { PartCode = item.GetMaterialDetail.PartCode, PartFigureCode = item.GetMaterialDetail.PartFigureCode, BarCode = item.GetPart.CorrespondingBarcode ?? "", DemandScanQuantity = item.GetMaterialDetail.PartQuantity - item.GetMaterialDetail.PartAlreadyScanQuantity, IsCrux = item.GetProcessBom.IsCrux ?? 0 }); } else { CenterData.Add(new MaterialScanModel() { PartCode = item.GetMaterialDetail.PartCode, PartFigureCode = item.GetMaterialDetail.PartFigureCode, BarCode = item.GetPart.CorrespondingBarcode ?? "", IsCrux = item.GetProcessBom.IsCrux ?? 0 }); } } RightData.Clear(); }
//******************************************************************************************************************// public void LoadData() { if (StoreInfo.MaterialOneSelf.IsCastingOrForging) { MaterialScanModel model = new MaterialScanModel() { PartCode = StoreInfo.MaterialOneSelf.MaterialInfo.PartCode ?? "", PartFigureCode = StoreInfo.MaterialOneSelf.MaterialInfo.FigureNo ?? "", BarCode = StoreInfo.MaterialOneSelf.MaterialInfo.ExtraInfo.PartInfo.CorrespondingBarcode ?? "", IsCrux = StoreInfo.MaterialOneSelf.MaterialInfo.ExtraInfo.BomInfo.IsCrux ?? 0 }; if (StoreInfo.MaterialOneSelf.MaterialInfo.AlreadyScanQuantity < StoreInfo.MaterialOneSelf.MaterialInfo.TotalQuantity) { model.DemandScanQuantity = StoreInfo.MaterialOneSelf.MaterialInfo.TotalQuantity - StoreInfo.MaterialOneSelf.MaterialInfo.AlreadyScanQuantity; LeftData.Add(model); } else { CenterData.Add(model); } } foreach (var item in StoreInfo.MaterialChild.MaterialInfos) { MaterialScanModel model = new MaterialScanModel() { PartCode = item.PartCode ?? "", PartFigureCode = item.FigureNo ?? "", BarCode = item.ExtraInfo.PartInfo.CorrespondingBarcode ?? "", IsCrux = item.ExtraInfo.BomInfo.IsCrux ?? 0 }; if (item.AlreadyScanQuantity < item.TotalQuantity) { model.DemandScanQuantity = item.TotalQuantity - item.AlreadyScanQuantity; LeftData.Add(model); } else { CenterData.Add(model); } } RightData.Clear(); }
public void BarCodeScan(object obj) { try { string barCode = obj.ToString(); BarCode = ""; if (string.IsNullOrEmpty(barCode)) { return; } MaterialScanModel leftModel = LeftData.SingleOrDefault(item => item.BarCode.Equals(barCode)); if (leftModel == null) { MaterialScanModel centerModel = CenterData.SingleOrDefault(item => item.BarCode.Equals(barCode)); if (centerModel == null) { MaterialScanModel rightModel = RightData.SingleOrDefault(item => item.BarCode.Equals(barCode)); if (rightModel == null) { //查该条码为何物 var result = ApiManager.GetPartCodeAndFigureNoByBarCode(barCode); if (result.Result) { dynamic dy = JsonConvert.DeserializeObject <dynamic>(result.Data.ToString()); RightData.Add(new MaterialScanModel() { PartCode = dy.PartCode, PartFigureCode = dy.FigureNo, AlreadyScanQuantity = 1, BarCode = barCode }); ApiManager.SaveBarCodeScanLog(barCode); } else { RightData.Add(new MaterialScanModel() { PartCode = "", PartFigureCode = $"无图号({barCode})", AlreadyScanQuantity = 1, BarCode = barCode }); } } else { rightModel.AlreadyScanQuantity++; //记录扫码日志 var result = ApiManager.SaveBarCodeScanLog(rightModel.BarCode); } } else { if (centerModel.IsCrux.Equals(1)) { if (centerModel.AlreadyScanQuantity < centerModel.DemandScanQuantity) { //执行出库 var resultA = ApiManager.MaterialScanOutput(centerModel.PartCode); if (resultA.Result) { //出库成功 centerModel.AlreadyScanQuantity++; } else { //出库失败 MessageBox.Show(resultA.Msg, "提示", MessageBoxButton.OK, MessageBoxImage.Asterisk); } } else { centerModel.AlreadyScanQuantity++; } //记录扫码日志 var resultB = ApiManager.SaveBarCodeScanLog(centerModel.BarCode); } else { centerModel.AlreadyScanQuantity = centerModel.DemandScanQuantity; //记录扫码日志 var resultB = ApiManager.SaveBarCodeScanLog(centerModel.BarCode, centerModel.DemandScanQuantity); } } } else { LeftData.Remove(leftModel); CenterData.Add(leftModel); if (leftModel.IsCrux.Equals(1)) { //执行出库 var resultA = ApiManager.MaterialScanOutput(leftModel.PartCode); if (resultA.Result) { //出库成功 leftModel.AlreadyScanQuantity++; } else { //出库失败 MessageBox.Show(resultA.Msg, "提示", MessageBoxButton.OK, MessageBoxImage.Asterisk); } //记录扫码日志 var resultB = ApiManager.SaveBarCodeScanLog(leftModel.BarCode); } else { leftModel.AlreadyScanQuantity = leftModel.DemandScanQuantity; //记录扫码日志 var resultB = ApiManager.SaveBarCodeScanLog(leftModel.BarCode, leftModel.DemandScanQuantity); } } } catch { } }
public void BarCodeScan(object obj) { try { string barCode = obj.ToString(); BarCode = ""; LogHelper.WriteLog($"条码:{barCode}"); if (string.IsNullOrEmpty(barCode)) { return; } MaterialScanModel materialScan_Left = LeftData.SingleOrDefault(item => item.BarCode.Equals(barCode)); LogHelper.WriteLog($"正在左侧搜索..."); if (materialScan_Left == null) { MaterialScanModel materialScan_Center = CenterData.SingleOrDefault(item => item.BarCode.Equals(barCode)); LogHelper.WriteLog($"正在中间搜索..."); if (materialScan_Center == null) { MaterialScanModel materialScan_Right = RightData.SingleOrDefault(item => item.BarCode.Equals(barCode)); LogHelper.WriteLog($"正在右侧搜索..."); if (materialScan_Right == null) { //查该条码为何物 LogHelper.WriteLog($"正在调用接口搜索...\r\n{string.Format(@"http://{0}/api/Mms/WinFormClient/GetPartAndPBomByBarCode?barCode={1}", ConfigInfoModel.API, barCode)}"); var result = new MaterialInfoBLL().GetPartAndPBomByBarCode(barCode); LogHelper.WriteLog($"搜索结果:{result.Result},详情:{result.Msg ?? ""}"); if (result.Result) { RightData.Add(new MaterialScanModel() { PartCode = result.Data.GetPart.PartCode ?? "", PartFigureCode = result.Data.GetProcessBom.PartFigureCode ?? "", AlreadyScanQuantity = 1, BarCode = barCode }); var aaa = new MaterialInfoBLL().SaveBarCodeScanLog(barCode); LogHelper.WriteLog($"记录扫码日志结果:{aaa.Result} {aaa.Msg ?? ""}"); } else { RightData.Add(new MaterialScanModel() { PartCode = "", PartFigureCode = $"无图号({barCode})", AlreadyScanQuantity = 1, BarCode = barCode }); //MessageBox.Show(result.Msg, "提示", MessageBoxButton.OK, MessageBoxImage.Asterisk); } } else { materialScan_Right.AlreadyScanQuantity++; var aaa = new MaterialInfoBLL().SaveBarCodeScanLog(barCode); LogHelper.WriteLog($"记录扫码日志结果:{aaa.Result} {aaa.Msg ?? ""}"); } } else { if (materialScan_Center.IsCrux.Equals(1)) { if (materialScan_Center.AlreadyScanQuantity < materialScan_Center.DemandScanQuantity) { //执行出库 var result = new MaterialInfoBLL().MaterialInventory(materialScan_Center.PartCode); if (result.Result) { //出库成功 materialScan_Center.AlreadyScanQuantity++; } else { //出库失败 MessageBox.Show(result.Msg, "提示", MessageBoxButton.OK, MessageBoxImage.Asterisk); } } else { materialScan_Center.AlreadyScanQuantity++; } var aaa = new MaterialInfoBLL().SaveBarCodeScanLog(barCode); LogHelper.WriteLog($"记录扫码日志结果:{aaa.Result} {aaa.Msg ?? ""}"); } else { materialScan_Center.AlreadyScanQuantity = materialScan_Center.DemandScanQuantity; var aaa = new MaterialInfoBLL().SaveBarCodeScanLog(barCode, materialScan_Center.DemandScanQuantity); LogHelper.WriteLog($"记录扫码日志结果:{aaa.Result} {aaa.Msg ?? ""}"); } } } else { LeftData.Remove(materialScan_Left); CenterData.Add(materialScan_Left); if (materialScan_Left.IsCrux.Equals(1)) { //执行出库 var result = new MaterialInfoBLL().MaterialInventory(materialScan_Left.PartCode); if (result.Result) { //出库成功 materialScan_Left.AlreadyScanQuantity++; } else { //出库失败 MessageBox.Show(result.Msg, "提示", MessageBoxButton.OK, MessageBoxImage.Asterisk); } var aaa = new MaterialInfoBLL().SaveBarCodeScanLog(barCode); LogHelper.WriteLog($"记录扫码日志结果:{aaa.Result} {aaa.Msg ?? ""}"); } else { materialScan_Left.AlreadyScanQuantity = materialScan_Left.DemandScanQuantity; var aaa = new MaterialInfoBLL().SaveBarCodeScanLog(barCode, materialScan_Left.DemandScanQuantity); LogHelper.WriteLog($"记录扫码日志结果:{aaa.Result} {aaa.Msg ?? ""}"); } } } catch (Exception ex) { LogHelper.WriteLog($"扫码异常:{ex}"); } }