|  |  | 
 |  |  |                 //反写工序出站单的合格数量 | 
 |  |  |                 oCN.RunProc("update Sc_StationOutBillMain set HQty+=1  where HProcExchInterID='" + HProcExchInterID + "' and HProcExchEntryID=" + HProcExchEntryID+ " and HInterID=" + HInterID); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn($@"select (b.HQty -sum(isnull(ou.HQty,0))-sum(isnull(ou.HBadCount,0))) HQty from Sc_ProcessExchangeBillSub b WITH(NOLOCK) | 
 |  |  | left join Sc_StationOutBillMain ou WITH(NOLOCK) on b.HInterID=ou.HProcExchInterID and b.HEntryID=ou.HProcExchEntryID | 
 |  |  | where b.HInterID={HProcExchInterID} and b.HEntryID={HProcExchEntryID} | 
 |  |  | group by b.HInterID,b.HEntryID,b.HQty", "Sc_ProcessExchangeBill_Out"); | 
 |  |  |  | 
 |  |  |                 if (double.Parse(ds.Tables[0].Rows[0][0].ToString()) < 0) { | 
 |  |  |                     oCN.RollBack(); | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "出站数量超过流转卡数量!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 oCN.Commit(); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  | 
 |  |  | //                        } | 
 |  |  |  | 
 |  |  |                         oCN.RunProc("update Gy_BarCodeBill set HStatus='' where HBarCode='" + model.HBarCode + "'"); | 
 |  |  |  | 
 |  |  |                         DataSet dataSet = oCN.RunProcReturn($"select top 1 HInterID  from Sc_StationOutBillMain where HProcExchInterID={subLsit[0].HProcExchInterID} and HProcExchEntryID={subLsit[0].HProcExchEntryID} and HBadCount>0", "Sc_StationOutBillMain"); | 
 |  |  |  | 
 |  |  |                         if (dataSet.Tables[0].Rows.Count > 0) | 
 |  |  |                         { | 
 |  |  |                             string HOutInterID = dataSet.Tables[0].Rows[0][0].ToString(); | 
 |  |  |  | 
 |  |  |                             oCN.RunProc("update Sc_StationOutBillMain set HBadCount-=1 where HInterID='" + HOutInterID + "'"); | 
 |  |  |                         } | 
 |  |  |                         else | 
 |  |  |                         { | 
 |  |  |                             oCN.RollBack(); | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = "保存失败,当前流转卡当前工序的出站单没有不良数量!"; | 
 |  |  |                             objJsonResult.data = null; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else { | 
 |  |  |                     oCN.RollBack(); | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "保存失败,无结果!"; |