| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// WMS忥æååºåºè³MES |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent ShipmentOrderSync(MesShipmentOrderSync model) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_ShipmentOrderSync.ToString()); |
| | | MESRoot<MesShipmentOrderSync> root = new MESRoot<MesShipmentOrderSync>() |
| | | { |
| | | From = "WMS", |
| | | DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Content = model |
| | | }; |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | string request = JsonConvert.SerializeObject(root, settings); |
| | | string response = HttpMesHelper.Post(apiInfo.ApiAddress, request); |
| | | MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); |
| | | //è°ç¨æ¥å£ |
| | | if (mesResponseContent.BSucc == true) |
| | | { |
| | | content.OK(mesResponseContent.StrMsg); |
| | | } |
| | | else |
| | | { |
| | | content.Error(mesResponseContent.StrMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | |
| | | { |
| | | return content.Error("æªæ¾å°ä»åºä¿¡æ¯"); |
| | | } |
| | | //夿æ¯å¦MESå
å
ä¿¡æ¯æ¯å¦éå¤ |
| | | List<Dt_MesProInOrderDetail> mesProInOrderDetails = new List<Dt_MesProInOrderDetail>(); |
| | | foreach (var item in bagInfoModel.BagDetails) |
| | | { |
| | | mesProInOrderDetails.Add(_mapper.Map<Dt_MesProInOrderDetail>(item)); |
| | | foreach (var child in item.BagItems) |
| | | { |
| | | Dt_MesProInOrderDetail mesProInOrderDetail=new Dt_MesProInOrderDetail() |
| | | { |
| | | BagNo=item.BagNo, |
| | | ProductCode=item.ProductCode, |
| | | ProductVersion=item.ProductVersion, |
| | | SETQty=child.SETQty, |
| | | OKPCSQTY=child.OKPCSQTY, |
| | | DateCode=item.DateCode, |
| | | XQty=child.XQty, |
| | | XSite=child.XSite, |
| | | Weight=item.Weight, |
| | | PackingDate=item.PackingDate, |
| | | LotNumber=child.LotNumber, |
| | | ERPOrder=child.ERPOrder, |
| | | SaleOrder=child.SaleOrder, |
| | | MoNumber=child.MoNumber, |
| | | }; |
| | | mesProInOrderDetails.Add(mesProInOrderDetail); |
| | | } |
| | | } |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails = new List<Dt_ProStockInfoDetail>(); |
| | | foreach (var item in mesProInOrderDetails) |
| | | { |
| | | proStockInfoDetails.Add(_mapper.Map<Dt_ProStockInfoDetail>(item)); |
| | | } |
| | | Dt_MesProInOrder mesProInOrder = new Dt_MesProInOrder() |
| | | { |
| | | WarehouseId = warehouse.WarehouseId, |
| | | BatchNo = bagInfoModel.BatchNo, |
| | | WorkCenter=bagInfoModel.WorkCenter, |
| | | MesProStatus = InOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | UnPackStock=bagInfoModel.UnPackStock, |
| | | Details= mesProInOrderDetails |
| | | }; |
| | | Dt_ProStockInfo proStockInfo = new Dt_ProStockInfo() |
| | | { |
| | | PalletCode = bagInfoModel.BatchNo, |
| | | PalletType = 1, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | StockStatus = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | proStockInfoDetails= proStockInfoDetails |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(mesProInOrder).Include(x=>x.Details).ExecuteCommand(); |
| | | Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK("æ¥æ¶æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | public MesResponseContent BoxStockin(MesBoxInfoModel boxInfoModel) |
| | | { |
| | | MesResponseContent content = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode==WarehouseEnum.HA101.ToString()); |
| | | //è·åMESå
å
ä¿¡æ¯ |
| | | List<Dt_MesProInOrderDetail> mesProInOrderDetails = new List<Dt_MesProInOrderDetail>(); |
| | | foreach (var item in boxInfoModel.Bags) |
| | | { |
| | | foreach (var child in item.BagItems) |
| | | { |
| | | Dt_MesProInOrderDetail mesProInOrderDetail = new Dt_MesProInOrderDetail() |
| | | { |
| | | BagNo = item.BagNo, |
| | | ProductCode = item.ProductCode, |
| | | ProductVersion = item.ProductVersion, |
| | | SETQty = child.SETQty, |
| | | OKPCSQTY = child.OKPCSQTY, |
| | | DateCode = item.DateCode, |
| | | XQty = child.XQty, |
| | | XSite = child.XSite, |
| | | Weight = item.Weight, |
| | | PackingDate = item.PackingDate, |
| | | LotNumber = child.LotNumber, |
| | | ERPOrder = child.ERPOrder, |
| | | SaleOrder = child.SaleOrder, |
| | | MoNumber = child.MoNumber, |
| | | }; |
| | | mesProInOrderDetails.Add(mesProInOrderDetail); |
| | | } |
| | | } |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails = new List<Dt_ProStockInfoDetail>(); |
| | | foreach (var item in mesProInOrderDetails) |
| | | { |
| | | proStockInfoDetails.Add(_mapper.Map<Dt_ProStockInfoDetail>(item)); |
| | | } |
| | | Dt_ProStockInfo proStockInfo = new Dt_ProStockInfo() |
| | | { |
| | | PalletCode = boxInfoModel.BoxNo, |
| | | PalletType = 0, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | ShipmentOrder= boxInfoModel.ShipmentOrder, |
| | | StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(), |
| | | proStockInfoDetails = proStockInfoDetails |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK("å¤å
æ¥æ¶æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æåè¿å·¥æåº |
| | | /// </summary> |