|  |  | 
 |  |  | (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,'{oSub.HBillNo_bak}',{oSub.HEmpID},'{oSub.HBarCode}',{oSub.HBadReasonID},'','{oSub.HMaker}','{oSub.HMakeDate}' | 
 |  |  | ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HICMOInterID},{oSub.HICMOEntryID},'{oSub.HICMOBillNo}',{oSub.HReportType} | 
 |  |  | ,0,0,'','',0,0 | 
 |  |  | ,0,'{HResult}',{oSub.HProcExchInterID},{oSub.HProcExchEntryID},'{oSub.HProcExchBillNo}')"); | 
 |  |  | ,1,'{HResult}',{oSub.HProcExchInterID},{oSub.HProcExchEntryID},'{oSub.HProcExchBillNo}',{oSub.HProcID})"); | 
 |  |  |  | 
 |  |  |             //修改条码表的状态 | 
 |  |  |             oCN.RunProc("update Gy_BarCodeBill set HStatus='"+ HResult + "' where HBarCode='"+ oSub.HBarCode + "'"); | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 string HProcID = "0"; | 
 |  |  |                 ds = oCN.RunProcReturn("select * from gy_czygl WITH(NOLOCK) where czymc='" + user + "'", "gy_czygl"); | 
 |  |  |                 string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString(); | 
 |  |  |                 if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                 { | 
 |  |  |                     HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString(); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //判断当前流转卡是否是开工 | 
 |  |  |                 ds = oCN.RunProcReturn("select  * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + HBarCode + "' and HICMOStatus<>'0'", "Sc_ICMOBillStatus_Tmp"); | 
 |  |  |                 if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "卡号:" + HBarCode + ",流转卡未开工!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn(@"exec h_p_Gy_BarCodeBillBomList '" + HBarCode + "'," + HProcID, "h_p_Gy_BarCodeBillBomList"); | 
 |  |  |                 if (ds.Tables[0].Rows.Count == 0) | 
 |  |  | 
 |  |  |                 sMainStr = "[" + sMainStr + "]"; | 
 |  |  |                 List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(sMainStr); | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn("select  HCenterID from Sc_ProcessExchangeBillSub WITH(NOLOCK) where HInterID=" + list[0].HProcExchInterID + " and HEntryID=" + list[0].HProcExchEntryID, "Sc_ProcessExchangeBillSub"); | 
 |  |  |                 ds = oCN.RunProcReturn("select HCenterID from Sc_ProcessExchangeBillSub WITH(NOLOCK) where HInterID=" + list[0].HProcExchInterID + " and HEntryID=" + list[0].HProcExchEntryID, "Sc_ProcessExchangeBillSub"); | 
 |  |  |                 if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                 { | 
 |  |  |                     list[0].HCenterID = long.Parse(ds.Tables[0].Rows[0]["HCenterID"].ToString()); | 
 |  |  | 
 |  |  |                 double HmaterOutqty = 0;//白坯发布 | 
 |  |  |                 double HProcPriceRate = 0;//工价系数 | 
 |  |  |                 int HTemporaryAreaID = 0;//暂放区 | 
 |  |  |                 int HShiftsID = 0; | 
 |  |  |  | 
 |  |  |                 DataSet set = oCN.RunProcReturn("exec h_p_Gy_GetWorkShiftInfo " + HDeptID + "," + 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("select  * from Sc_StationOutBillMain a WITH(NOLOCK) left join  Sc_StationOutBillSub_SN sn WITH(NOLOCK) on a.HInterID=sn.HInterID where a.HInterID=" + HInterID + " and HBillNo='" + HBillNo + "' and CONVERT(varchar(10),HDate,20) ='" + DateTime.Now.ToString("yyyy-MM-dd") + "' ", "Sc_StationOutBillMain"); | 
 |  |  |  | 
 |  |  |                 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 + "'" + | 
 |  |  |                     " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" + | 
 |  |  |                     "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + | 
 |  |  |                     "," + HICMOInterID + ",'" + HICMOBillNo + "'," + HProcPlanInterID + "," + HProcPlanEntryID + ",'" + HProcPlanBillNo + "'," + HProcExchInterID + "," + HProcExchEntryID + | 
 |  |  |                     ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + "," + HICMOQty + "," + HPlanQty + ",getdate()," + HSourceID + "," + HPayProcID + | 
 |  |  | 
 |  |  |                     "," + 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 + ") "); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                |