//-------------------------------------------------------------------------------------------------------------------------- // 名称:生成Where语句 // // //-------------------------------------------------------------------------------------------------------------------------- /// <summary> /// 获取3D WHERE 查询语句 /// </summary> public string GetSql_Where(Maticsoft.Model.WorkOrder _WorkOrder, ArrayList _PigtailList, string SN) { Maticsoft.BLL.TestStandard_Exfo _M_TestStandard = new Maticsoft.BLL.TestStandard_Exfo(); //生成SN 的IN 查询条件 string TemSNList = ""; TemSNList = Get_SNList(SN, _PigtailList); // ArrayList _testStandard = _M_TestStandard.GetArrayList("(OrderID = '" + _WorkOrder.OrderID + "')"); string srt_testStadard = Generate_Where(_testStandard); if (_WorkOrder.InspectMethod == E_InspectMethod.MPO检测) { srt_testStadard = Generate_Where(_testStandard, "MPO"); } //生成Where语句 // if (!srt_testStadard.Equals("")) //如果不为空 { TemSNList = TemSNList + " AND " + srt_testStadard; } return("SN IN" + TemSNList); }
/// <summary> /// 生产跳线查询语句 /// </summary> /// <param name="_WorkOrder"></param> /// <param name="_SNList"></param> /// <returns></returns> public string GetSql_Where(Maticsoft.Model.WorkOrder _WorkOrder, ArrayList _SNList) { Maticsoft.BLL.TestStandard_3D _M_TestStandard = new Maticsoft.BLL.TestStandard_3D(); //生成SN 的IN 查询条件 string TemSNList = ""; TemSNList = Get_SNList(_SNList); // ArrayList _testStandard = _M_TestStandard.GetArrayList("(OrderID = '" + _WorkOrder.OrderID + "')"); string srt_testStadard = Generate_Where(_testStandard); // if (!srt_testStadard.Equals("")) //如果不为空 { TemSNList = TemSNList + " AND " + srt_testStadard; } return("SN IN" + TemSNList); }
/// <summary> /// 生成并保存外袋 /// </summary> /// <returns></returns> public string Sack_SerialNumber(string ordrID, string sackQty) { /*********************************************************** * * 编码规则为:工单单号+00001 * 外袋编码Demo :130000100001 * * *********************************************************/ if (ordrID != "" && sackQty != "") { WorkOrder wo = new WorkOrder(); Maticsoft.Model.WorkOrder Tem = wo.GetModel(ordrID); int orderCount = 0; if (Tem != null) { orderCount = int.Parse(Tem.Count); //总批量 } int _TemSackQty = int.Parse(sackQty); //单袋数量 int _TemGenerateCount = orderCount / _TemSackQty; //需要生成多少个外袋编码 long SN = long.Parse(ordrID.Substring(4, 7) + "00000"); int Add_Yet = 0, Add_Not = 0; //记录添加成功的数量 string message = ""; //实体类赋值 Maticsoft.Model.SerialNumber temSerialNumber = new Maticsoft.Model.SerialNumber(); temSerialNumber.OrderID = ordrID; temSerialNumber.Type = Maticsoft.Model.E_SerialNumber_Type.SackSN.ToString(); if (Exists_Where("(OrderID ='" + temSerialNumber.OrderID + "') AND ( Type ='" + temSerialNumber.Type + "')")) { Add_Yet = GetRecordCount("(SN ='" + temSerialNumber.SN + "') AND ( Type ='" + temSerialNumber.OrderID + "')"); message = "工单:" + ordrID + "外袋编码已添加!"; } else { string tem_ExrrySnList = ""; for (int i = 1; i < _TemGenerateCount + 1; i++) { temSerialNumber.SN = (SN + i).ToString(); //判断是否重复 if (!Exists_Where("(OrderID ='" + temSerialNumber.OrderID + "') AND ( Type ='" + temSerialNumber.Type + "')")) { //判断是否添加成功 if (Add(temSerialNumber)) { Add_Yet++; //记录添加成功数量 } else { Add_Not++; tem_ExrrySnList += "\r\n:" + temSerialNumber.SN + "\r\n"; } } else { tem_ExrrySnList += "\r\n此编码重复:" + temSerialNumber.SN + "\r\n"; } } message = "外袋编码添加\r\n成功:" + Add_Yet + "条\r\n失败:" + Add_Not + "条" + tem_ExrrySnList; } return(message); } else { string message = "未添加外袋条码!"; return(message); } }