| | |
| | | else if (num == 1) |
| | | { |
| | | //判断这个条码之前的状态是否为NG |
| | | DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "' and HCreateTime<'" + dic["HCreateTime"].ToString() + "' and HResult='NG' and HProcNumber='" + dic["HProcNumber"].ToString() + "'", "Sb_EquipMentCollection_SN"); |
| | | DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "' and HCreateTime<'" + dic["HCreateTime"].ToString() + "' and HResult='NG'", "Sb_EquipMentCollection_SN"); |
| | | |
| | | //查询出站单是否包含条码 |
| | | DataSet ds1 = oCN.RunProcReturn(@"select a.HSourceID,a.HProcID,* from Sc_StationOutBillMain a WITH(NOLOCK) |
| | | inner join Sc_StationOutBillSub_SN sn WITH(NOLOCK) on a.HInterID=sn.HInterID |
| | | left join Gy_Source s WITH(NOLOCK) on a.HSourceID=s.HItemID |
| | |
| | | //查询职员 |
| | | ds = oCN.RunProcReturn("select * from Gy_Employee WITH(NOLOCK) where HNumber='" + dic["HEmpCode"].ToString() + "' ", "Gy_Employee"); |
| | | long HEmpIDs = 0; |
| | | string HEmpName = ""; |
| | | if (ds.Tables[0].Rows.Count != 0) |
| | | { |
| | | HEmpIDs = long.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());//职员ID |
| | | HEmpName = ds.Tables[0].Rows[0]["HName"].ToString(); |
| | | } |
| | | |
| | | long HDeptID = 0; |
| | |
| | | string sReturn = ""; |
| | | if (GetSingleSystemParameter("WMS_CampanyName", ref sReturn) == "杭州斯莫尔") |
| | | { |
| | | HDeptID = 389499; |
| | | HDeptID = 389505; |
| | | HPRDOrgIDs = 100199; |
| | | } |
| | | else { |
| | |
| | | |
| | | |
| | | |
| | | ds = oCN.RunProcReturn(@"select b.HProcNo,b.HProcID,a.HMaterID,a.HQty,a.HInterID,HEntryID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo from Sc_ProcessExchangeBillMain a WITH(NOLOCK) |
| | | ds = oCN.RunProcReturn(@"select a.HWorkShopID,b.HProcNo,b.HProcID,a.HMaterID,a.HQty,a.HInterID,HEntryID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo,b.HCenterID from Sc_ProcessExchangeBillMain a WITH(NOLOCK) |
| | | inner join Sc_ProcessExchangeBillSub b WITH(NOLOCK) on a.HInterID=b.HInterID |
| | | left join Gy_Process p WITH(NOLOCK) on b.HProcID=p.HItemID |
| | | where a.HBillNo='" + HProcExchBillNo + "' and p.HNumber='" + HProcNumber + "'", "Sc_ProcessExchangeBillMain"); |
| | |
| | | long HMainInterID = 0; |
| | | string BillType = "3791"; |
| | | string HBillSubType = "3791"; |
| | | |
| | | string HWorkShopID= ds.Tables[0].Rows[0]["HWorkShopID"].ToString(); |
| | | int HBillStatus = 1; |
| | | string HMaker = "";//制单人 |
| | | string HMaker = HEmpName;//制单人 |
| | | string HMouldNum = "";//模穴号 |
| | | int HYear = DateTime.Now.Year; |
| | | double HPeriod = DateTime.Now.Month; |
| | |
| | | double HPrice = 0; |
| | | double HMoney = 0; |
| | | double HBadCount = 0;//不良数量 |
| | | long HCenterID = 0;//工作中心ID |
| | | long HCenterID = long.Parse(ds.Tables[0].Rows[0]["HCenterID"].ToString());//工作中心ID |
| | | string HProcNo = ds.Tables[0].Rows[0]["HProcNo"].ToString();//流水号 |
| | | string HOrderProcNO = "";//订单跟踪号 |
| | | string HSourceNameList = "";//设备清单 |
| | |
| | | int HTemporaryAreaID = 0;//暂放区 |
| | | long HInterID = 0; |
| | | string HBillNo = ""; |
| | | int HShiftsID = 0; |
| | | |
| | | DataSet set= oCN.RunProcReturn("exec h_p_Gy_GetWorkShiftInfo " + HWorkShopID + "," + HCenterID, "h_p_Gy_GetWorkShiftInfo"); |
| | | if (set.Tables[0].Rows.Count > 0) { |
| | | HShiftsID = int.Parse(set.Tables[0].Rows[0]["HInterID"].ToString()); |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S '" + HBadCodeSN + "'," + HProcID, "h_v_Gy_QualifiedRecordsList"); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | |
| | | ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" + |
| | | ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" + |
| | | ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" + |
| | | ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID" + |
| | | ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID,HShiftsID" + |
| | | ") " + |
| | | " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" + |
| | | "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + |
| | |
| | | "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" + |
| | | "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + |
| | | "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID + |
| | | "," + HmaterOutqty + "," + HProcPriceRate + "," + HTemporaryAreaID + ") "); |
| | | "," + HmaterOutqty + "," + HProcPriceRate + "," + HTemporaryAreaID + ","+ HShiftsID + ") "); |
| | | } |
| | | |
| | | if (HResult == "OK") |
| | |
| | | } |
| | | else if (HResult == "NG") |
| | | { |
| | | //反写工序出站单的不良数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain set HBadCount+=1 where HInterID='" + HInterID + "'"); |
| | | ds = oCN.RunProcReturn("select * from Sc_QualityReportBillSub WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "' order by HMakeDate desc", "Sc_QualityReportBillSub"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) { |
| | | string HBadDate = ds.Tables[0].Rows[0]["HMakeDate"].ToString(); |
| | | |
| | | ds = oCN.RunProcReturn("select * from Sc_SourceLineRepairBillMain WITH(NOLOCK) where HBarCode='" + HBadCodeSN + "' order by HMakeDate desc", "Sc_SourceLineRepairBillMain"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) { |
| | | string HRepairDate = ds.Tables[0].Rows[0]["HMakeDate"].ToString(); |
| | | |
| | | if (DateTime.Parse(HBadDate) < DateTime.Parse(HRepairDate)) { |
| | | //反写工序出站单的不良数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain set HBadCount+=1 where HInterID='" + HInterID + "'"); |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | //反写工序出站单的不良数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain set HBadCount+=1 where HInterID='" + HInterID + "'"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | string sReturn = ""; |
| | | if (GetSingleSystemParameter("WMS_CampanyName", ref sReturn) == "杭州斯莫尔") |
| | | { |
| | | HDeptID = 389499; |
| | | HDeptID = 389505; |
| | | HPRDOrgIDs = 100199; |
| | | } |
| | | else |
| | |
| | | CustomWriteLog("条码:" + HBadCodeSN + "工序:"+ HProcNumber + ",出站时间:" + HMakeTime, "TM" + DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | //反写工序出站单的合格数量 |
| | | oCN.RunProc("update Sc_StationOutBillMain set HQty+=1,HBadCount-=1 where HInterID='" + HInterID + "'"); |
| | | //oCN.RunProc("update Sc_StationOutBillMain set HQty+=1,HBadCount-=1 where HInterID='" + HInterID + "'"); |
| | | oCN.RunProc("update Sc_StationOutBillMain set HQty+=1 where HInterID='" + HInterID + "'"); |
| | | //反写条码状态 |
| | | oCN.RunProc("update Gy_BarCodeBill set HStatus='' where HBarCode='" + HBadCodeSN + "'"); |
| | | } |
| | |
| | | { |
| | | |
| | | |
| | | DataSet ds = oCN.RunProcReturn("select * from Sc_StationOutBillMain WITH(NOLOCK) where HInterID=" + HInterID + " and HBillNo='" + HBillNo + "'", "Sc_StationOutBillMain"); |
| | | DataSet ds = oCN.RunProcReturn(@"select a.HProcExchInterID,a.HProcExchEntryID,a.HProcExchBillNo,a.HProcID,p.HNumber from Sc_StationOutBillMain a WITH(NOLOCK) |
| | | left join Gy_Process p WITH(NOLOCK) on a.HProcID=p.HItemID where HInterID=" + HInterID + " and HBillNo='" + HBillNo + "'", "Sc_StationOutBillMain"); |
| | | string HProcExchInterID = ds.Tables[0].Rows[0]["HProcExchInterID"].ToString(); |
| | | string HProcExchEntryID = ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString(); |
| | | string HProcExchBillNo = ds.Tables[0].Rows[0]["HProcExchBillNo"].ToString(); |
| | | string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString(); |
| | | string HProcNum = ds.Tables[0].Rows[0]["HNumber"].ToString(); |
| | | //注:因为 组装 拍照 时间间隔比较短 所以目前只明确组装工序才可以保存工艺参数 之后如果有其他工序的话 需要增加工序字段 |
| | | if (HProcID == "88") { |
| | | ds = oCN.RunProcReturn(@"select s.HItemID HMouldID,t.HItemID HTechParamID,HCount,HCreateTime from Sb_EquipMentCollectionTechParam_SN a WITH(NOLOCK) |
| | | if (HProcID == "88"|| HProcNum=="005") { |
| | | ds = oCN.RunProcReturn(@"select s.HItemID HMouldID,t.HItemID HTechParamID,HCount,HCreateTime,a.HResult from Sb_EquipMentCollectionTechParam_SN a WITH(NOLOCK) |
| | | inner join Gy_Source s WITH(NOLOCK) on a.HSourceCode=s.HNumber |
| | | inner join Gy_TechnologyParameter t WITH(NOLOCK) on a.HType=t.HName |
| | | where a.HFlag=0 and a.HBarCode='" + HBadCodeSN + "'", "Sb_EquipMentCollectionTechParam_SN"); |
| | |
| | | string HTechParamID = ds.Tables[0].Rows[i]["HTechParamID"].ToString(); |
| | | string HCount = ds.Tables[0].Rows[i]["HCount"].ToString(); |
| | | string HGetTime = ds.Tables[0].Rows[i]["HCreateTime"].ToString(); |
| | | string HResult = ds.Tables[0].Rows[i]["HResult"].ToString(); |
| | | |
| | | DataSet dataSet = oCN.RunProcReturn("select * from Sc_StationOutBillSub_TechParam WITH(NOLOCK) where HInterID=" + HInterID + " and HBillNo_bak='" + HBillNo + "'", "Sc_StationOutBillSub_TechParam"); |
| | | |
| | | sql = "insert into Sc_StationOutBillSub_TechParam(HInterID,HBillNo_bak,HEntryID ,HSourceInterID,HSourceEntryID,HSourceBillNo,HTechParamID,HRelValue,HGetTime,HBarCode,HMouldID)" + |
| | | $"values({HInterID},'{HBillNo}',{(dataSet.Tables[0].Rows.Count + 1)},{HProcExchInterID},{HProcExchEntryID},'{HProcExchBillNo}',{HTechParamID},{HCount},'{HGetTime}','{HBadCodeSN}',{HMouldID})"; |
| | | sql = "insert into Sc_StationOutBillSub_TechParam(HInterID,HBillNo_bak,HEntryID ,HSourceInterID,HSourceEntryID,HSourceBillNo,HTechParamID,HRelValue,HGetTime,HBarCode,HMouldID,HRemark)" + |
| | | $"values({HInterID},'{HBillNo}',{(dataSet.Tables[0].Rows.Count + 1)},{HProcExchInterID},{HProcExchEntryID},'{HProcExchBillNo}',{HTechParamID},{HCount},'{HGetTime}','{HBadCodeSN}',{HMouldID},'{HResult}')"; |
| | | |
| | | oCN.RunProc(sql); |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | DataSet ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill"); |
| | | //判断条码是否存在条码档案 |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | string HSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString(); |
| | | DataSet dataTable = oCN.RunProcReturn(@"select * from Sc_ProcessExchangeBillMain where HBillNo='" + HSourceBillNo + "'", "Sc_ProcessExchangeBillMain"); |
| | | //判断条码的源单 流转卡是否被删除 |
| | | if (dataTable.Tables[0].Rows.Count == 0) |
| | | { |
| | | //如果源单已经删除 则条码也删除重新生成 |
| | | oCN.RunProc("delete from Gy_BarCodeBill where HBarCode='" + HBadCodeSN + "'"); |
| | | |
| | | //重新查询条码档案 进入新增方法 |
| | | ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill where HBarCode='" + HBadCodeSN + "'", "Gy_BarCodeBill"); |
| | | } |
| | | } |
| | | |
| | | //判断条码是否在数据库里 |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | //判断长度是否为29位 |
| | | //判断长度是否为29位 无尘车间 |
| | | if (HBadCodeSN.Length == 29) |
| | | { |
| | | string str1 = HBadCodeSN.Substring(23, 3); |
| | | string str1 = HBadCodeSN.Substring(18, 8); |
| | | ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%'", "Sc_ProcessExchangeBillMain"); |
| | | //判断是否能找到对应的流转卡 |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | string HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | get_HBardBillSave(HBadCodeSN, HProcExchBillNo); |
| | | } |
| | | else |
| | | { |
| | | str1 = HBadCodeSN.Substring(23, 3); |
| | | ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%'", "Sc_ProcessExchangeBillMain"); |
| | | //判断是否能找到对应的流转卡 |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | string HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | get_HBardBillSave(HBadCodeSN, HProcExchBillNo); |
| | | } |
| | | else |
| | | { |
| | | oCN.RollBack(); |
| | | CustomWriteLog("条码:" + HBadCodeSN + ",流转卡不存在!", DateTime.Now.ToString("yyyy-MM-dd")); |
| | | return 2; |
| | | } |
| | | } |
| | | } |
| | | //判断长度是否为50位 15车间 |
| | | else if (HBadCodeSN.Length == 50) |
| | | { |
| | | string str1 = HBadCodeSN.Substring(42, 8); |
| | | ds = oCN.RunProcReturn("select * from Sc_ProcessExchangeBillMain where HProjectNum like'" + str1 + "-1%'", "Sc_ProcessExchangeBillMain"); |
| | | //判断是否能找到对应的流转卡 |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | |
| | | //定时读取数据 |
| | | private void timer1_Tick(object sender, EventArgs e) |
| | | { |
| | | DataTable list = oCN.RunProcReturn("select * from Sb_EquipMentCollection_SN WITH(NOLOCK) where HFlag=0 order by HCreateTime", "Sb_EquipMentCollection_SN").Tables[0]; |
| | | DataTable list = oCN.RunProcReturn("select top 100 * from Sb_EquipMentCollection_SN WITH(NOLOCK) where HFlag=0 order by HCreateTime asc", "Sb_EquipMentCollection_SN").Tables[0]; |
| | | |
| | | //循环集合 |
| | | for (int i = 0; i < list.Rows.Count; i++) |
| | |
| | | string HResult = list.Rows[i]["HResult"].ToString(); |
| | | string HBadCodeSN = list.Rows[i]["HBarCode"].ToString(); |
| | | string HCreateTime = list.Rows[i]["HCreateTime"].ToString(); |
| | | |
| | | //HBadCodeSN = "P1099081-00-E:SDU324292189300"; |
| | | //HResult = "OK"; |
| | | //开始事务 |
| | | oCN.BeginTran(); |
| | | |
| | | if (HResult == "OK") |
| | | if (HResult == "OK") |
| | | { |
| | | flag = HResultOK(list.Rows[i]); |
| | | } |
| | |
| | | string sReturn = ""; |
| | | if (GetSingleSystemParameter("WMS_CampanyName", ref sReturn) == "杭州斯莫尔") |
| | | { |
| | | HDeptID = 389499; |
| | | HDeptID = 389505; |
| | | } |
| | | else |
| | | { |
| | |
| | | string HProcExchEntryID = "0"; |
| | | string HProcExchBillNo = ""; |
| | | long HMaterID = 0; |
| | | long HProcID = 0; |
| | | long HUnitID = 0; |
| | | long HICMOInterID = 0; |
| | | long HICMOEntryID = 0; |
| | | string HICMOBillNo = ""; |
| | | ds = oCN.RunProcReturn(@"select HMaterID,HUnitID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo,HBillNo,a.HInterID,b.HEntryID,a.HBillNo from Sc_ProcessExchangeBillMain a WITH(NOLOCK) |
| | | ds = oCN.RunProcReturn(@"select b.HProcID, HMaterID,HUnitID,a.HICMOInterID,a.HICMOEntryID,a.HICMOBillNo,HBillNo,a.HInterID,b.HEntryID,a.HBillNo from Sc_ProcessExchangeBillMain a WITH(NOLOCK) |
| | | inner join Sc_ProcessExchangeBillSub b WITH(NOLOCK) on a.HInterID=b.HInterID |
| | | left join Gy_Process p WITH(NOLOCK) on b.HProcID=p.HItemID |
| | | where HBillNo=(select HSourceBillNo from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + dic["HBarCode"].ToString() + "') and p.HNumber='" + dic["HProcNumber"].ToString() + "' ", "Sc_ProcessExchangeBillMain"); |
| | |
| | | HProcExchInterID = ds.Tables[0].Rows[0]["HInterID"].ToString(); |
| | | HProcExchEntryID = ds.Tables[0].Rows[0]["HEntryID"].ToString(); |
| | | HProcExchBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | HProcID = int.Parse(ds.Tables[0].Rows[0]["HProcID"].ToString()); |
| | | } |
| | | |
| | | |
| | |
| | | (HInterID,HENTRYID,HBillNo_bak,HEmpID,HBarCode,HBadReasonID,HAddr,HMaker,HMakeDate |
| | | ,HMaterID,HUnitID,HRemark,HSourceID,HICMOInterID,HICMOEntryID,HICMOBillNo,HReportType |
| | | ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney |
| | | ,HQty,HResult,HProcExchInterID,HProcExchEntryID,HProcExchBillNo) |
| | | ,HQty,HResult,HProcExchInterID,HProcExchEntryID,HProcExchBillNo,HProcID) |
| | | values({HInterID},1,'{HBillNo}',{HEmpID},'{HBarCode}',0,'','{HMaker}','{HMakeDate}' |
| | | ,{HMaterID},{ HUnitID},'',{HSourceID},{ HICMOInterID},{ HICMOEntryID},'{HICMOBillNo}',0 |
| | | ,0,0,'','',0,0 |
| | | ,0,'{HResult}',{ HProcExchInterID},{ HProcExchEntryID},'{ HProcExchBillNo}')"); |
| | | ,1,'{HResult}',{ HProcExchInterID},{ HProcExchEntryID},'{ HProcExchBillNo}'," + HProcID + ")"); |
| | | |
| | | return true; |
| | | } |