|  |  | 
 |  |  |         /// <returns></returns> | 
 |  |  |         [Route("Cg_POInStockBill/DeltetPOInStockBill")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object DeltetPOInStockBill(string HInterID, string user) | 
 |  |  |         public object DeltetPOInStockBill(string HInterID, string HsupId, string HQty, string HSourceInterID, string HSourceEntryID, string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 DataSet dss; | 
 |  |  |                 //判断是否有删除的权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Cg_POInStockBill_Drop", 1, false, user)) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                 if (objJsonResult.code == "0") | 
 |  |  |                     return objJsonResult; | 
 |  |  |  | 
 |  |  |                 oCN.BeginTran(); | 
 |  |  |                 oCN.RunProc("Delete From Cg_POInStockBillMain where HInterID = " + HInterID); | 
 |  |  |                 oCN.RunProc("Delete From Cg_POInStockBillSub where HInterID = " + HInterID); | 
 |  |  |                 oCN.BeginTran(); //开始事务 | 
 |  |  |                 //查询数据 | 
 |  |  |                 ds = oCN.RunProcReturn("select * from Cg_POInStockBillMain a inner join Cg_POInStockBillSub b on a.HInterID=b.HInterID  where a.HInterID= '" + HInterID + "'", "Kf_ICStockBillMain"); | 
 |  |  |                //执行存储过程进行反写 | 
 |  |  |                 dss = oCN.RunProcReturn("exec h_p_Cg_POOrderBillMain_Delete " + HQty + ", '" + HSourceInterID + "', '" + HSourceEntryID + "','" + user + " '", "h_p_Cg_POInStockBillMain"); | 
 |  |  |                 var sReturn = ""; | 
 |  |  |                 if (DBUtility.ClsPub.isLong(dss.Tables[0].Rows[0]["HBack"]) != 0) | 
 |  |  |                 { | 
 |  |  |                     sReturn = DBUtility.ClsPub.isStrNull(dss.Tables[0].Rows[0]["HBackRemark"]).ToString(); | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = sReturn; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows.Count == 1) | 
 |  |  |                 { | 
 |  |  |                     oCN.RunProc("delete Cg_POInStockBillMain where HInterID=" + HInterID); | 
 |  |  |                     oCN.RunProc("delete Cg_POInStockBillSub where HInterID=" + HInterID); | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     oCN.RunProc($"delete Cg_POInStockBillSub where HInterID={ HInterID}and HEntryID={HsupId}"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 oCN.Commit(); | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         //反审核 删除 删除金蝶数据库对应 收料通知到数据 | 
 |  |  |         public json DeleteKingDee(string hinterid) | 
 |  |  |         public json DeleteKingDee(string HInterID) | 
 |  |  |         { | 
 |  |  |             string sql = string.Format("select HinterID,HERPBillNO,HERPInterID from Cg_POInStockBillMain where HERPInterID>0 and hinterid in (" + hinterid + ")"); | 
 |  |  |             string sql = string.Format("select HinterID,HERPBillNO,HERPInterID from Cg_POInStockBillMain where HERPInterID>0 and hinterid in (" + HInterID + ")"); | 
 |  |  |             DataTable dt = oCN.RunProcReturn(sql, "deleteDt").Tables[0]; | 
 |  |  |             if (dt.Rows.Count > 0) | 
 |  |  |             { | 
 |  |  | 
 |  |  |                                 "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + | 
 |  |  |                                  ",HSupID=" + HSupID + ",HCurID=" + HCurID | 
 |  |  |                                  + ",HExRate=" + HExRate + ",HEmpID=" + HEmpID + ",HManagerID=" + HManagerID + ",HDeptID=" + HDeptID | 
 |  |  |                                  + ",HAddress='" + HAddress + " where HInterID=" + HInterID); | 
 |  |  |                                  + ",HAddress='" + HAddress + "' where HInterID=" + HInterID); | 
 |  |  |  | 
 |  |  |                     //删除子表 | 
 |  |  |                     oCN.RunProc("delete from Cg_POInStockBillSub where HInterID='" + HInterID + "'"); | 
 |  |  |                 } | 
 |  |  |                 //保存子表 | 
 |  |  |                 objJsonResult = AddBillSub(msg3, HInterID, OperationType); | 
 |  |  |                 objJsonResult = AddBillSub(msg3, HInterID, OperationType,user); | 
 |  |  |  | 
 |  |  |                 if (objJsonResult.code == "0") | 
 |  |  |                 { | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         public json AddBillSub(string msg3, long HInterID, int OperationType) | 
 |  |  |         public json AddBillSub(string msg3, long HInterID, int OperationType,string user) | 
 |  |  |         { | 
 |  |  |             List<ClsCg_POInStockBillSub> DetailColl = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsCg_POInStockBillSub>>(msg3); | 
 |  |  |  | 
 |  |  | 
 |  |  |             string HPROJECTNO = DetailColl2[0].HPROJECTNO == null ? "''" : DetailColl2[0].HPROJECTNO; | 
 |  |  |             string HGIVEAWAY = DetailColl2[0].HGIVEAWAY == null ? "''" : DetailColl2[0].HGIVEAWAY; | 
 |  |  |             string HCHECKINCOMING = DetailColl2[0].HCHECKINCOMING == null ? "''" : DetailColl2[0].HCHECKINCOMING; | 
 |  |  |             string HDISCOUNTRATE = DetailColl2[0].HDISCOUNTRATE == null ? "''" : DetailColl2[0].HDISCOUNTRATE; | 
 |  |  |             string HDISCOUNTRATE = DetailColl2[0].HDISCOUNTRATE == null ? "'0'" : DetailColl2[0].HDISCOUNTRATE; | 
 |  |  |             double HPRICECOEFFICIENT = DetailColl2[0].HPRICECOEFFICIENT == null ? 0 : DetailColl2[0].HPRICECOEFFICIENT; | 
 |  |  |             long HPRICEUNITID = DetailColl2[0].HPRICEUNITID == null ? 0 : DetailColl2[0].HPRICEUNITID; | 
 |  |  |             long HPRICELISTENTRY = DetailColl2[0].HPRICELISTENTRY == null ? 0 : DetailColl2[0].HPRICELISTENTRY; | 
 |  |  | 
 |  |  |                     NewHEntryID = ClsPub.isLong(Cs.Tables[0].Rows[0]["HEntryID"].ToString()); | 
 |  |  |                     NewHEntryID += 1; | 
 |  |  |                 } | 
 |  |  |                 //反写采购入库单 | 
 |  |  |                 string sReturn = ""; | 
 |  |  |                 ds = oCN.RunProcReturn("exec h_p_Cg_POOrderBillMain " + oSub.HQty + ", '" + oSub.HSourceInterID + "', '" + oSub.HSourceEntryID + "','" + user + " '", "h_p_Cg_POOrderBillMain"); | 
 |  |  |                 if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0) | 
 |  |  |                 { | 
 |  |  |                     sReturn = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]).ToString(); | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = sReturn; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 oCN.RunProc($@"Insert into Cg_POInStockBillSub  | 
 |  |  |                 (HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice | 
 |  |  | 
 |  |  |                ,HEXCHANGERATE,HLOCALCURRID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX | 
 |  |  |                ,HTAXRATEID,HCOSTPERCENT,HCOSTAMOUNT,HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING,HSecUnitID)  | 
 |  |  |                  values({HInterID},{NewHEntryID},{oSub.HMaterID},{oSub.HUnitID},{(oSub.HQty == null ? 0 : oSub.HQty)} | 
 |  |  |                 ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},{HSourceBillNo},{HSourceBillType},{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},{HPOOrderBillNo},{HAuxPropID},{HBatchNO},{HMTONo},{HPlanMode},{HERPInterID},{HERPEntryID},{HRelationQty},{HGiveAwayFlag},{HReceiveQty},{HSEQ},{HPRODUCEDATE},{HEXPIRYDATE}, | 
 |  |  |                 ,{oSub.HPrice},{oSub.HMoney},{oSub.HWHID},{oSub.HSPID},'{HRemark}',{oSub.HSourceInterID},{oSub.HSourceEntryID},'{HSourceBillNo}',{HSourceBillType},{oSub.HPOOrderInterID},{oSub.HPOOrderEntryID},{HPOOrderBillNo},{HAuxPropID},{HBatchNO},{HMTONo},{HPlanMode},{HERPInterID},{HERPEntryID},{HRelationQty},{HGiveAwayFlag},{HReceiveQty},{HSEQ},{HPRODUCEDATE},{HEXPIRYDATE}, | 
 |  |  |                   {HSUPPLYLOT},{HREQTRACENO},{HBOMID},{HSTOCKUNITID},{HBASEUNITID},{HSTOCKSTATUSID},'{HKEEPERTYPEID}',{HPROJECTNO},{HCHECKINCOMING},{oSub.HTaxPrice},{HDISCOUNTRATE},{HPRICECOEFFICIENT},{HPRICEUNITID},{HPRICELISTENTRY},{HSAMPLEDAMAGEQTY},{HSAMPLEDAMAGEBASEQTY},{HPAYORGID},{HSETTLEORGID},{HSETTLECURRID},{HSETTLEMODEID},{HEXCHANGETYPEID},{HPAYCONDITONID},{oSub.HEXCHANGERATE},{HLOCALCURRID},{HISINCLUDEDTAX},{HISPRICEEXCLUDETAX},{HTAXRATEID},{HCOSTPERCENT},{HCOSTAMOUNT},{HVAT},{HSELLERWITHHOLDING},{HBUYERWITHHOLDING},{oSub.HSecUnitID})"); | 
 |  |  |                  | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             objJsonResult.code = "1"; | 
 |  |  | 
 |  |  | ,HSTOCKGROUPID,HSENDBILLNO,HLADBILLNO,HPURDEPTID,HPURGROUPID,HSUPPLYID | 
 |  |  | ,HSETTLEID,HCHARGEID,HBUSINESSTYPE,HSUPPLYADDRESS,HCORRESPONDORGID,HPROVIDERCONTACTID,HCurID,HExRate,HAddress,HWHID,HInnerBillNo) | 
 |  |  | values(" + mainList[0].HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1103 + "','" + | 
 |  |  | mainList[0].HBillSubType + "','" + mainList[0].HDate + "','" + mainList[0].HBillNo + "'," + mainList[0].HBillStatus + "," + mainList[0].HSupDealerID + "," + mainList[0].HSupID + | 
 |  |  | mainList[0].HBillSubType + "','" + mainList[0].HDate + "','" + mainList[0].HBillNo + "'," + mainList[0].HBillStatus + "," + (mainList[0].HSupDealerID == 0 ? mainList[0].HSupID : mainList[0].HSupDealerID) + "," + mainList[0].HSupID + | 
 |  |  | "," + mainList[0].HManagerID + "," + mainList[0].HEmpID + "," + mainList[0].HDeptID + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker + | 
 |  |  | "','" + mainList[0].HMakeDate + "','" + mainList[0].HChecker + "','" + mainList[0].HCheckDate + "','" + mainList[0].HOWNERTYPEID + "'," + mainList[0].HOWNERID + "," + mainList[0].HERPInterID + ",'" + mainList[0].HERPBillType + "'," + mainList[0].HPURCHASEORGID + "," + mainList[0].HSTOCKORGID + "," + mainList[0].HREQUIREORGID + "," + | 
 |  |  | mainList[0].HSTOCKGROUPID + ",'" + mainList[0].HSENDBILLNO + "','" + mainList[0].HLADBILLNO + "'," + mainList[0].HPURDEPTID + "," + mainList[0].HPURGROUPID + "," + mainList[0].HSUPPLYID + "," + |