dengjunjie
4 天以前 bea5e8a7d4d764ec0eb35e766a879e85a1424ca4
н¨Îļþ¼Ð/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs
@@ -476,18 +476,24 @@
                        }
                        //_materielInfoService.UpdateData(materielInfo);
                    }
                    _unitOfWorkManage.BeginTran();
                    if (materielInfosUp.Count > 0) _materielInfoService.UpdateData(materielInfosUp);
                    if (entityOrder.Details.Count > 0) dt_CabinOrders.Add(entityOrder);
                    if (entityOrderLK.Details.Count > 0) dt_CabinOrders.Add(entityOrderLK);
                    if (dt_CabinOrders.Count > 0) BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
                    _unitOfWorkManage.CommitTran();
                    try
                    {
                        _unitOfWorkManage.BeginTran();
                        if (materielInfosUp.Count > 0) _materielInfoService.UpdateData(materielInfosUp);
                        if (entityOrder.Details.Count > 0) dt_CabinOrders.Add(entityOrder);
                        if (entityOrderLK.Details.Count > 0) dt_CabinOrders.Add(entityOrderLK);
                        if (dt_CabinOrders.Count > 0) BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
                        _unitOfWorkManage.CommitTran();
                    }
                    catch (Exception)
                    {
                        _unitOfWorkManage.RollbackTran();
                    }
                    //webResponseContent.OK(data: dt_CabinOrders);
                }
            }
            catch (Exception ex)
            {
                _unitOfWorkManage.RollbackTran();
                _messageInfoService.AddMessageInfo(MessageGroupByEnum.InOrderAlarm, (order.order_type == "2" ? "出库退货" : "正常入库") + $":单号【{order.order_no}】", ex.Message);
                webResponseContent.Error(ex.Message);
            }
@@ -551,11 +557,13 @@
                            }
                            #endregion
                            inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
                            inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                            inventoryInfo.SupplyQuantity = 0;
                            inventoryInfo.StockStatus = StockStatusEmun.入库完成.ObjToInt();
                        }
                        infosUp.AddRange(inventoryInfos);
                        inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
                        inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity;
                        inventory_Batch.SupplyQuantity = 0;
                        batchesUp.Add(inventory_Batch);
                        //_inventoryInfoService.UpdateData(inventoryInfos);
@@ -649,12 +657,14 @@
                                }
                                #endregion
                                inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
                                inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                                inventoryInfo.SupplyQuantity = 0;
                                inventoryInfo.StockStatus = StockStatusEmun.入库完成.ObjToInt();
                            }
                            //_inventoryInfoService.UpdateData(inventoryInfos);
                            infosUp.AddRange(inventoryInfos);
                            inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
                            inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity;
                            inventory_Batch.SupplyQuantity = 0;
                            //_inventory_BatchServices.UpdateData(inventory_Batch);
                            batchesUp.Add(inventory_Batch);
@@ -720,6 +730,7 @@
                                }
                                #endregion
                                inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
                                inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                                inventoryInfo.SupplyQuantity = 0;
                                inventoryInfo.StockStatus = StockStatusEmun.入库完成.ObjToInt();
                            }
@@ -832,6 +843,7 @@
                else
                {
                    var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
                    if (cabinOrder.Order_type == "2") url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
                    var requestDate = new
                    {
                        order_no = cabinOrder.Order_no
@@ -839,7 +851,7 @@
                    var result = HttpHelper.Post(url, requestDate.ToJsonString());
                    var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
                    if (response == null) throw new Exception("上报ERP入库单完成失败!");
                    if (response.resultCode != "0") throw new Exception(response.resultMsg);
                    if (response.resultCode != "0" && response.resultMsg != "未找到合法单据") throw new Exception(response.resultMsg);
                    _cabinOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetails, OperateTypeEnum.人工完成);
                    BaseDal.DeleteAndMoveIntoHty(cabinOrders, OperateTypeEnum.人工完成);