|  |  | 
 |  |  |  | 
 |  |  |                 oCN.BeginTran(); | 
 |  |  |                 var ds = oCN.RunProcReturn("select * from Xs_SeOutStockBillMain where HInterID=" + HInterID, "Xs_SeOutStockBillMain"); | 
 |  |  |                  | 
 |  |  |                 var dss = oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain_Delete " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Xs_SeOutStockBillMain_Delete"); | 
 |  |  |                 //删除撤销  发货通知单 反写 销售订单 | 
 |  |  |                 oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain_Delete " + HInterID, "h_p_Xs_SeOutStockBillMain_Delete"); | 
 |  |  |                 //删除前控制 | 
 |  |  |                 DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_BeforeDelCtrl  " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBill_BeforeDelCtrl"); | 
 |  |  |                 if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) | 
 |  |  |                 { //修改 | 
 |  |  |  | 
 |  |  |                     DataSet dss; | 
 |  |  |                     dss = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBillList where hmainid=" + HInterID + " and 单据号='" + HBillNo + "'", "h_v_IF_SeOutStockBillList"); | 
 |  |  |                     //判断是否可编辑 | 
 |  |  |                     if (dss.Tables[0].Rows[0]["审核人"].ToString() != "" && dss.Tables[0].Rows[0]["审核人"] != null) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "此单据已经被审核,不允许修改!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     if (dss.Tables[0].Rows[0]["状态"].ToString() != "创建") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; | 
 |  |  |                         objJsonResult.data = 1; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     string sql = $@"update Xs_SeOutStockBillMain  set " + | 
 |  |  |                                 "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" + | 
 |  |  |                                  ",HCusID='" + HCusID + "', HCurID='" + HCurID + "', HWHID = '" + HWHID | 
 |  |  | 
 |  |  |                                  + "',HAddress='" + HAddress + "',HProjectID='"+ HProjectID + "' where HInterID=" + HInterID; | 
 |  |  |                     oCN.RunProc(sql); | 
 |  |  |  | 
 |  |  |                     //删除 撤销发货通知单 反写 销售订单 | 
 |  |  |                     oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain_Delete " + HInterID, "h_p_Xs_SeOutStockBillMain_Delete"); | 
 |  |  |  | 
 |  |  |                     //删除子表 | 
 |  |  |                     oCN.RunProc("delete from Xs_SeOutStockBillSub where HInterID='" + HInterID + "'"); | 
 |  |  |                 } | 
 |  |  |                 //保存子表 | 
 |  |  |                 objJsonResult = AddBillSub(msg3, HInterID, OperationType,user); | 
 |  |  |  | 
 |  |  |                //发货通知的 反写 数量到 销售订单 关联数量 | 
 |  |  |                 oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain " + HInterID, "h_p_Xs_SeOutStockBillMain"); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 //保存后控制========================================= | 
 |  |  |                  ds = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',1 ", "h_p_Xs_SeOutStockBill_AfterSaveCtrl"); | 
 |  |  |                 ds = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',1 ", "h_p_Xs_SeOutStockBill_AfterSaveCtrl"); | 
 |  |  |                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  | 
 |  |  |  | 
 |  |  |                 oCN.RunProc(sql); | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn("exec h_p_Xs_SeOutStockBillMain " + oSub.HQty + ", '" + oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user + " '", "h_p_Xs_SeOutStockBillMain"); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             objJsonResult.code = "1"; |