/// <summary> /// InsertInfo /// </summary> /// <param name="info">对象</param> /// <returns></returns> public long InsertInfo(EmergencyPullingCartInfo info) { if (info.LogisticStandardFid == null) { throw new Exception("MC:0x00000084");///数据错误 } MaintainInhouseLogisticStandardInfo standardInfo = new MaintainInhouseLogisticStandardDAL().GetInfoByFid(info.LogisticStandardFid.GetValueOrDefault()); if (standardInfo == null) { throw new Exception("MC:0x00000084");///数据错误 } /// GetEmergencyPullingCartInfo(standardInfo, ref info); ///REQUIRED_BOX_QTY if (info.PullPackageQty.GetValueOrDefault() > 0) { info.RequiredBoxQty = Convert.ToInt32(Math.Ceiling(info.RequiredPartQty.GetValueOrDefault() / info.PullPackageQty.GetValueOrDefault())); } ///EMERGENCY_PULL_MODE if (info.EmergencyPullMode == null) { throw new Exception("MC:0x00000084");///数据错误 } ///STATUS info.Status = 10; return(dal.Add(info)); }
/// <summary> /// Create EmergencyPullingCartInfo /// </summary> /// <param name="loginUser"></param> /// <returns>EmergencyPullingCartInfo</returns> public static EmergencyPullingCartInfo CreateEmergencyPullingCartInfo(string loginUser) { EmergencyPullingCartInfo info = new EmergencyPullingCartInfo(); ///FID info.Fid = Guid.NewGuid(); ///LOGISTIC_STANDARD_FID info.LogisticStandardFid = null; ///REQUIRED_PART_QTY info.RequiredPartQty = null; ///EMERGENCY_PULL_MODE info.EmergencyPullMode = null; ///TRIGGER_PULL_FLAG info.TriggerPullFlag = null; ///TRIGGER_WM_NO info.TriggerWmNo = null; ///TRIGGER_ZONE_NO info.TriggerZoneNo = null; ///STATUS info.Status = null; ///COMMENTS info.Comments = null; ///VALID_FLAG info.ValidFlag = true; ///CREATE_DATE info.CreateDate = DateTime.Now; ///CREATE_USER info.CreateUser = loginUser; ///MODIFY_DATE info.ModifyDate = null; ///MODIFY_USER info.ModifyUser = null; return(info); }
/// <summary> /// ReceiveInfo-->EmergencyPullingCartInfo /// </summary> /// <param name="receiveInfo"></param> /// <param name="info"></param> public static void GetEmergencyPullingCartByReceive(ReceiveInfo receiveInfo, ref EmergencyPullingCartInfo info) { if (receiveInfo == null) { return; } ///PULL_MODE,拉动方式 //info.PullMode = receiveInfo.PullMode.GetValueOrDefault(); /////PART_BOX_CODE,零件类代码 //info.PartBoxCode = receiveInfo.PartBoxCode; }
/// <summary> /// ReceiveDetailInfo-->EmergencyPullingCartInfo /// </summary> /// <param name="receiveDetailInfo"></param> /// <param name="info"></param> public static void GetEmergencyPullingCartByReceiveDetail(ReceiveDetailInfo receiveDetailInfo, ref EmergencyPullingCartInfo info) { if (receiveDetailInfo == null) { return; } ///PART_NO,物料图号 info.PartNo = receiveDetailInfo.PartNo; ///REQUIRED_PART_QTY,物料需求数量 info.RequiredPartQty = receiveDetailInfo.RequiredQty.GetValueOrDefault(); ///REQUIRED_BOX_QTY,包装需求数量 info.RequiredBoxQty = receiveDetailInfo.RequiredBoxNum.GetValueOrDefault(); ///PART_CNAME,物料中文描述 info.PartCname = receiveDetailInfo.PartCname; ///PULL_PACKAGE_QTY,拉动包装数 ///TODO: Package和InhousePackage 那个有效? info.PullPackageQty = receiveDetailInfo.Package.GetValueOrDefault(); ///PULL_PACKAGE_MODEL,拉动包装型号 ///TODO:PackageModel和InhousePackageModel 那个有效? info.PullPackageModel = receiveDetailInfo.PackageModel; ///SUPPLIER_NUM,供应商代码 info.SupplierNum = receiveDetailInfo.SupplierNum; ///S_WM_NO,来源仓库 info.SWmNo = receiveDetailInfo.WmNo; ///S_ZONE_NO,来源存储区 info.SZoneNo = receiveDetailInfo.ZoneNo; ///T_WM_NO,目标仓库 info.TWmNo = receiveDetailInfo.TargetWm; ///T_ZONE_NO,目标存储区 info.TZoneNo = receiveDetailInfo.TargetZone; ///PLANT,工厂代码 info.Plant = receiveDetailInfo.Plant; ///ASSEMBLY_LINE,产线代码 info.AssemblyLine = receiveDetailInfo.AssemblyLine; ///EMERGENCY_PULL_MODE,紧急拉动模式 info.EmergencyPullMode = (int)EmergencyPullModeConstants.ManualPull; ///STATUS,状态 info.Status = 10;///已提交 TODO:没有枚举项 }
/// <summary> /// MaintainInhouseLogisticStandardInfo -> EmergencyPullingCartInfo /// </summary> /// <param name="maintainInhouseLogisticStandardInfo"></param> /// <param name="info"></param> public static void GetEmergencyPullingCartInfo(MaintainInhouseLogisticStandardInfo maintainInhouseLogisticStandardInfo, ref EmergencyPullingCartInfo info) { if (maintainInhouseLogisticStandardInfo == null) { return; } ///LOGISTICSTANDARD_FID info.LogisticStandardFid = maintainInhouseLogisticStandardInfo.Fid; ///PART_NO info.PartNo = maintainInhouseLogisticStandardInfo.PartNo; ///PART_CNAME info.PartCname = maintainInhouseLogisticStandardInfo.PartCname; ///PULL_PACKAGE_QTY info.PullPackageQty = maintainInhouseLogisticStandardInfo.InboundPackage; ///PULL_PACKAGE_MODEL info.PullPackageModel = maintainInhouseLogisticStandardInfo.InboundPackageModel; ///SUPPLIER_NUM info.SupplierNum = maintainInhouseLogisticStandardInfo.SupplierNum; ///PULL_MODE info.PullMode = Convert.ToInt32(maintainInhouseLogisticStandardInfo.InhouseSystemMode); ///PART_BOX_CODE info.PartBoxCode = maintainInhouseLogisticStandardInfo.InhousePartClass; ///S_WM_NO info.SWmNo = maintainInhouseLogisticStandardInfo.SWmNo; ///S_ZONE_NO info.SZoneNo = maintainInhouseLogisticStandardInfo.SZoneNo; ///T_WM_NO info.TWmNo = maintainInhouseLogisticStandardInfo.TWmNo; ///T_ZONE_NO info.TZoneNo = maintainInhouseLogisticStandardInfo.TZoneNo; ///PLANT info.Plant = maintainInhouseLogisticStandardInfo.Plant; ///WORKSHOP info.Workshop = maintainInhouseLogisticStandardInfo.Workshop; ///ASSEMBLY_LINE info.AssemblyLine = maintainInhouseLogisticStandardInfo.AssemblyLine; ///WORKSHOP_SECTION info.WorkshopSection = maintainInhouseLogisticStandardInfo.WorkshopSection; ///LOCATION info.Location = maintainInhouseLogisticStandardInfo.Location; }
/// <summary> /// 发布 /// </summary> /// <param name="rowsKeyValues"></param> /// <param name="loginUser"></param> /// <returns></returns> public bool ReleaseInfos(List <string> rowsKeyValues, string loginUser) { List <EmergencyPullingCartInfo> emergencyPullingCarts = new List <EmergencyPullingCartInfo>(); foreach (var rowsKeyValue in rowsKeyValues) { string[] keyValues = rowsKeyValue.Split(new char[] { '^' }, StringSplitOptions.RemoveEmptyEntries); if (keyValues.Length == 0) { throw new Exception("MC:0x00000084");///数据错误 } if (keyValues.Length == 1) { throw new Exception("MC:0x00000502");///物料需求数量不能为空 } EmergencyPullingCartInfo emergencyPullingCart = new EmergencyPullingCartInfo(); emergencyPullingCart.Id = Convert.ToInt64(keyValues[0]); emergencyPullingCart.RequiredPartQty = Convert.ToDecimal(keyValues[1]); if (emergencyPullingCart.RequiredPartQty <= 0) { throw new Exception("MC:0x00000507");///物料需求数量不能小于等于零 } emergencyPullingCarts.Add(emergencyPullingCart); } List <EmergencyPullingCartInfo> emergencyPullingCartInfos = dal.GetList("[ID] in (" + string.Join(",", emergencyPullingCarts.Select(d => d.Id).ToArray()) + ")", string.Empty); if (emergencyPullingCartInfos.Count == 0) { throw new Exception("MC:0x00000084");///数据错误 } StringBuilder @string = new StringBuilder(); foreach (EmergencyPullingCartInfo emergencyPullingCartInfo in emergencyPullingCartInfos) { EmergencyPullingCartInfo cartInfo = emergencyPullingCarts.FirstOrDefault(d => d.Id == emergencyPullingCartInfo.Id); if (cartInfo == null) { continue; } emergencyPullingCartInfo.RequiredPartQty = cartInfo.RequiredPartQty; ///REQUIRED_BOX_QTY if (emergencyPullingCartInfo.PullPackageQty.GetValueOrDefault() > 0) { emergencyPullingCartInfo.RequiredBoxQty = Convert.ToInt32(Math.Ceiling(emergencyPullingCartInfo.RequiredPartQty.GetValueOrDefault() / emergencyPullingCartInfo.PullPackageQty.GetValueOrDefault())); } @string.AppendLine("update [LES].[TE_MPM_EMERGENCY_PULLING_CART] " + "set [VALID_FLAG] = 0," + "[REQUIRED_PART_QTY] = " + emergencyPullingCartInfo.RequiredPartQty.GetValueOrDefault() + "," + "[REQUIRED_BOX_QTY] = " + emergencyPullingCartInfo.RequiredBoxQty.GetValueOrDefault() + "," + "[MODIFY_USER] = N'" + loginUser + "'," + "[MODIFY_DATE] = GETDATE() " + "where [ID] = " + emergencyPullingCartInfo.Id + ";"); } @string.AppendLine(Handler(emergencyPullingCartInfos, loginUser)); ///执行 using (var trans = new TransactionScope()) { if (@string.Length > 0) { CommonDAL.ExecuteNonQueryBySql(@string.ToString()); } trans.Complete(); } return(true); }