/// <summary> /// 物料其他出入库,转序出库 /// </summary> /// <param name="state"></param> /// <returns></returns> public ResultModel MaterialInventory(MaterialStateEnum state) { string url = string.Empty; string json = string.Empty; switch (state) { case MaterialStateEnum.OtherOutput: #region 其他出库 旧方法-一次性出库所有 /* * url = "http://" + ConfigInfoModel.API + "/api/Mms/WinFormClient/PostMaterialOtherOutputStorage"; * * List<object> list = new List<object>(); * foreach (var item in StoreInfoModel.MaterialInfos) * { * if (item.GetPart == null) * { * continue; * } * * list.Add(new * { * InventoryCode = item.GetPart.InventoryCode, * InventoryName = item.GetPart.InventoryName, * Specs = item.GetPart.Model, * Unit = item.GetPart.QuantityUnit, * MateNum = item.GetMaterialDetail.PartQuantity, * ConfirmNum = item.GetMaterialDetail.PartQuantity, * UserName = StoreInfoModel.WorkGroupInfo.GetWorkGroupDetail.UserName, * PBillCode = StoreInfoModel.ProducePlanInfo.GetProjectProduceDetial.ApsCode, * BatchCode = "NewBatchCode" * }); * } * json = Helpers.HttpHelper.PostJSON(url, new * { * mainData = new * { * ContractCode = StoreInfoModel.ProducePlanInfo.GetProjectProduceDetial.ContractCode, * ProjectName = StoreInfoModel.ProducePlanInfo.GetProject.ProjectName, * WarehouseCode = StoreInfoModel.WorkGroupInfo.GetWarehouse.WarehouseCode, * WarehouseName = StoreInfoModel.WorkGroupInfo.GetWarehouse.WarehouseName, * UserName = StoreInfoModel.WorkGroupInfo.GetWorkGroupDetail.UserName, * ApproveState = 2 * }, * detailData = list * }); */ #endregion break; case MaterialStateEnum.TurnInput: url = "http://" + ConfigInfoModel.API + "/api/Mms/WinFormClient/PostMaterialTurnInputStorage"; #region 转序入库 var pprModel = HttpHelper.GetTByUrl <ResultModel <dynamic> >(string.Format(@"http://{0}/api/Mms/WinFormClient/GetTurnTarget?ppdID={1}", ConfigInfoModel.API, StoreInfoModel.ProducePlanInfo.GetProjectProduceDetial.ID)); //dynamic dynamicObject = JsonConvert.DeserializeObject<dynamic>(json); if (pprModel.Result) { json = BLL.Helpers.HttpHelper.PostJSON(url, new { mainData = new { ContractCode = StoreInfoModel.ProducePlanInfo.GetProjectProduceDetial.ContractCode, ProjectName = StoreInfoModel.ProducePlanInfo.GetProject.ProjectName, //WarehouseCode = StoreInfoModel.ProducePlanInfo.GetProductProcessRoute.WarehouseID, //WarehouseName = StoreInfoModel.ProducePlanInfo.GetProductProcessRoute.WarehouseName, WarehouseCode = pprModel.Data.ID, WarehouseName = pprModel.Data.Name, UserName = StoreInfoModel.WorkGroupInfo.GetWorkGroupDetail.UserName, ApproveState = StoreInfoModel.ProducePlanInfo.GetProductProcessRoute.WarehouseID.Equals(StoreInfoModel.WorkGroupInfo.GetWarehouse.WarehouseCode) ? 2 : 1 }, detailData = new { InventoryCode = StoreInfoModel.MaterialInfo.GetPart.InventoryCode, InventoryName = StoreInfoModel.MaterialInfo.GetPart.InventoryName, Specs = StoreInfoModel.MaterialInfo.GetPart.Model, Unit = StoreInfoModel.MaterialInfo.GetPart.QuantityUnit, //MateNum = StoreInfoModel.ProducePlanInfo.GetProjectProduceDetial.Quantity, //ConfirmNum = StoreInfoModel.ProducePlanInfo.GetProjectProduceDetial.Quantity, MateNum = StoreInfoModel.ProducePlanInfo.GetProjectProduceDetial.WorkQuantity, ConfirmNum = StoreInfoModel.ProducePlanInfo.GetProjectProduceDetial.WorkQuantity, UserName = StoreInfoModel.WorkGroupInfo.GetWorkGroupDetail.UserName, PBillCode = StoreInfoModel.ProducePlanInfo.GetProjectProduceDetial.ApsCode, BatchCode = "NewBatchCode" } }); } else { return(new ResultModel() { Result = false, Msg = pprModel.Msg }); } #endregion break; default: #region 参数异常 return(new ResultModel() { Result = false, Msg = @"内部参数错误!" }); #endregion } return(JsonConvert.DeserializeObject <ResultModel>(json)); }
public MaterialState GetState(MaterialStateEnum materialStateEnum) { return(_uow.MaterialStates.GetAll().First(ms => ms.Name == materialStateEnum.ToString())); }