| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- 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;
- }
- /// <summary>
- /// 查询合同量转换参数
- /// </summary>
- /// <param name="desginKey">质量设计</param>
- /// <param name="mscPline">制程</param>
- /// <param name="ordLnDlyPk">交货Pk</param>
- /// <param name="plineCodeD">轧管选用产线</param>
- /// <param name="bom">选用BOM</param>
- /// <param name="codeJg">接箍码</param>
- /// <param name="putRate">投料率</param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 查询合同量转换参数
- /// </summary>
- /// <param name="desginKey">质量设计</param>
- /// <param name="mscPline">制程</param>
- /// <param name="ordLnDlyPk">交货Pk</param>
- /// <param name="plnDivideId">排产流水号</param>
- /// <param name="plineCodeD">轧管选用产线</param>
- /// <param name="bom">选用BOM</param>
- /// <param name="codeJg">接箍码</param>
- /// <param name="putRate">投料率</param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 查询合同量转换参数
- /// </summary>
- /// <param name="orderQty">顶货量</param>
- /// <param name="orderUnit">订货单位</param>
- /// <param name="desginKey">质量设计</param>
- /// <param name="mscPline">制程</param>
- /// <param name="ordLnDlyPk">交货Pk</param>
- /// <param name="plineCodeD">轧管选用产线</param>
- /// <param name="bom">选用BOM</param>
- /// <param name="codeJg">接箍码</param>
- /// <param name="putRate">投料率</param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 验证合同量计算参数是否有误
- /// </summary>
- /// <param name="param"></param>
- /// <param name="?"></param>
- /// <returns></returns>
- 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 "";
- }
- /// <summary>
- /// 合同量计算传入参数实体类
- /// </summary>
- internal InOrdParamEntity InEnity
- {
- get { return inEnity; }
- set { inEnity = value; }
- }
- }
- }
|