using System; using CoreFS.CA06; using com.steering.pss.plnsaleord.ordAmCal.model; using System.Windows.Forms; using Core.Mes.Client.Comm.Server; namespace Core.StlMes.Client.PlnSaleOrd.BaseMethod { class PlnGetOrdAmount { private OpeBase opeBase = null; InOrdParamEntity inEnity = null; public PlnGetOrdAmount(OpeBase _ob) { opeBase = _ob; } public OutOrdParamEntity getOrdAmount() { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.plnsaleord.order.baseMethod.CoreGetOrdAmount"; ccp.MethodName = "getOrdCalResult"; ccp.ServerParams = new object[] { inEnity }; ccp = opeBase.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal); if (ccp == null || ccp.ReturnObject == null) { MessageBox.Show("服务端处理失败!"); return null; } return (OutOrdParamEntity)ccp.ReturnObject; } /// /// 查询合同量转换参数 /// /// 质量设计 /// 制程 /// 交货Pk /// 轧管选用产线 /// 选用BOM /// 接箍码 /// 投料率 /// public InOrdParamEntity getInOrdParam(string desginKey, string mscPline, string ordLnDlyPk, string plineCodeD, string bom, string codeJg, Double putRate) { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.plnsaleord.order.baseMethod.CoreGetOrdAmount"; ccp.MethodName = "getInOrdParam"; ccp.ServerParams = new object[] { desginKey, mscPline, ordLnDlyPk, plineCodeD, bom, codeJg, putRate }; ccp = opeBase.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal); if (ccp == null || ccp.ReturnObject == null) { MessageBox.Show("服务端处理失败!"); return null; } return (InOrdParamEntity)ccp.ReturnObject; } /// /// 查询合同量转换参数 /// /// 质量设计 /// 制程 /// 交货Pk /// 排产流水号 /// 轧管选用产线 /// 选用BOM /// 接箍码 /// 投料率 /// public InOrdParamEntity getInOrdPlnParam(string desginKey, string mscPline, string ordLnDlyPk, string plnDivideId, string plineCodeD, string bom, string codeJg, Double putRate) { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.plnsaleord.order.baseMethod.CoreGetOrdAmount"; ccp.MethodName = "getInOrdPlnParam"; ccp.ServerParams = new object[] { desginKey, mscPline, ordLnDlyPk, plnDivideId, plineCodeD, bom, codeJg, putRate }; ccp = opeBase.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal); if (ccp == null || ccp.ReturnObject == null) { MessageBox.Show("服务端处理失败!"); return null; } return (InOrdParamEntity)ccp.ReturnObject; } /// /// 查询合同量转换参数 /// /// 顶货量 /// 订货单位 /// 质量设计 /// 制程 /// 交货Pk /// 轧管选用产线 /// 选用BOM /// 接箍码 /// 投料率 /// public InOrdParamEntity getInOrdPlnQtyParam(Double orderQty, string orderUnit, string desginKey, string mscPline, string ordLnDlyPk, string plineCodeD, string bom, string codeJg, Double putRate) { CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.pss.plnsaleord.order.baseMethod.CoreGetOrdAmount"; ccp.MethodName = "getInOrdPlnQtyParam"; ccp.ServerParams = new object[] { orderQty, orderUnit, desginKey, mscPline, ordLnDlyPk, plineCodeD, bom, codeJg, putRate }; ccp = opeBase.ExecuteSortResultByQueryToDataTable(ccp, CoreInvokeType.Internal); if (ccp == null || ccp.ReturnObject == null) { MessageBox.Show("服务端处理失败!"); return null; } return (InOrdParamEntity)ccp.ReturnObject; } /// /// 验证合同量计算参数是否有误 /// /// /// /// public bool isRightParam(InOrdParamEntity inEntity, string desginKey, string codeJg, string bom, string dPline, out string errMessage) { errMessage = ""; if (desginKey.Equals("")) { errMessage = "未找到工艺评审。"; return false; } if (inEntity == null) { errMessage = "查询合同量转换参数出错。"; return false; } if (!inEntity.OrderUnit.Equals("支") && !inEntity.OrderUnit.Equals("英磅") && !inEntity.OrderUnit.Equals("吨") && !inEntity.OrderUnit.Equals("米") && !inEntity.OrderUnit.Equals("英尺")) { errMessage = "合同订货单位未知!"; return false; } if (inEntity.OrderQty <= 0) { errMessage = "合同订货量必须大于零!"; return false; } if (inEntity.Totlength > 0) { if (!inEntity.TotlengthUnit.Equals("米") && !inEntity.TotlengthUnit.Equals("英尺")) { errMessage = "合同有保总长,但保总长单位未知!"; return false; } } if (inEntity.Totlength < 0) { errMessage = "合同保总长不能为负数!"; return false; } if (!inEntity.OrderUnit.Equals("支")) { #region if (inEntity.LengthMax <= 0) { errMessage = "合同长度上限必须大于零!"; return false; } if (inEntity.LengthMin < 0) { errMessage = "合同长度下限不能为负数!"; return false; } if (inEntity.LengthMax < inEntity.LengthMin) { errMessage = "合同长度上限不能小于下限!"; return false; } if (inEntity.Outdiameter <= 0) { errMessage = "合同外径必须大于零!"; return false; } if (inEntity.Wallthick <= 0) { errMessage = "合同壁厚必须大于零!"; return false; } if (inEntity.Outdiameter < inEntity.Wallthick) { errMessage = "合同外径不能小于壁厚!"; return false; } if (inEntity.DiameterZg <= 0) { errMessage = "轧管工序,轧管规格外径必须大于零!\n BOM:" + bom; return false; } if (inEntity.HeightZg <= 0) { errMessage = "轧管工序,轧管规格壁厚必须大于零!\n BOM:" + bom; return false; } if (inEntity.DiameterZg < inEntity.HeightZg) { errMessage = "轧管规格外径不能小于壁厚!\n BOM:" + bom; return false; } if (inEntity.DiameterPl == null || inEntity.DiameterPl.Count == 0) { errMessage = "管坯坯料断面规格未知!\n BOM:" + bom; return false; } else { for (int i = 0; i < inEntity.DiameterPl.Count; i++) { if (inEntity.DiameterPl[0] <= 0) { errMessage = "管坯坯料断面必须大于零!\n BOM:" + bom; return false; } } } if (inEntity.CutHeadEnd < 0) { errMessage = "轧管工序,切头尾不能为负数!\n BOM:" + bom + ",轧管机组:" + getPlineNameByCode(dPline, opeBase); return false; } if (inEntity.LengthMaxRing <= 0) { errMessage = "轧管工序,环形炉最大长度未知!\n 轧管机组:" + getPlineNameByCode(dPline, opeBase); return false; } if (inEntity.LengthColdbed <= 0) { errMessage = "轧管工序,产线冷床长度必须大于零!\n 轧管机组:" + getPlineNameByCode(dPline, opeBase); return false; } if (inEntity.Sigllen < 0) { errMessage = "单倍尺长不能为负数!"; return false; } if (inEntity.BurnoutRate < 0 || inEntity.BurnoutRate > 100) { errMessage = "轧管烧损率有误!\n 烧损率" + inEntity.BurnoutRate + "%\n 轧管机组:" + getPlineNameByCode(dPline, opeBase); return false; } if (inEntity.BurnoutDbk < 0 || inEntity.BurnoutDbk > 100) { errMessage = "镦拔扩烧损率有误!\n 烧损率" + inEntity.BurnoutDbk + "%。"; return false; } if (inEntity.Footmin < 0) { errMessage = "短尺最短不能为负数!"; return false; } if (inEntity.StdWallthickMax == 0 && inEntity.StdWallthickMin == 0) { errMessage = "未找到交货标准"; return false; } if (inEntity.AddLengthDbk < 0) { errMessage = "镦拔扩切头尾长度不能为负数!\n BOM:" + bom; return false; } if (inEntity.AddLengthDc < 0) { errMessage = "镦粗影响长度不能为负数!\n BOM:" + bom; return false; } if (inEntity.InspectLen < 0) { errMessage = "探伤盲区切长度值不能为负数!"; return false; } #endregion } if (inEntity.OrderUnit.Equals("英磅") || inEntity.OrderUnit.Equals("吨")) { if (inEntity.Totlength == 0) { if (inEntity.WeightType != 0 && inEntity.WeightType != 1 && inEntity.WeightType != -1) { errMessage = "合同按重量交货,但未知计重方式!"; return false; } } } if (inEntity.DelvryRangeMax < 0 || inEntity.DelvryRangeMin < 0) { errMessage = "合同交货量差有误!"; return false; } if (inEntity.DelvryRangeTpe != 1 && inEntity.DelvryRangeTpe != 2) { errMessage = "合同交货量差方式未知!"; return false; } if (inEntity.WeightJg < 0) { errMessage = "接箍单重不能为负数!\n 接箍码:"+codeJg; return false; } if (inEntity.CheckJVal < 0) { errMessage = "接箍测量J值不能为负数!\n 接箍码:" + codeJg; return false; } return true; } public static string getPlineNameByCode(string plineCode,OpeBase _ob) { System.Data.DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.order" + ".baseMethod.CoreGetOrdAmount.getPlineNameByCode", new object[] { plineCode }, _ob); if (dt != null && dt.Rows.Count > 0) { return dt.Rows[0]["PLINE_NAME"].ToString(); } return ""; } /// /// 合同量计算传入参数实体类 /// internal InOrdParamEntity InEnity { get { return inEnity; } set { inEnity = value; } } } }