|  |  |  | 
|---|
|  |  |  | #region 车间收料列表 撤销确认收料 | 
|---|
|  |  |  | [Route("Cj_SendGoodsBill/DeptCheckGoodsBillList_revoke")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object DeptCheckGoodsBillList_revoke(string HInterID, string User) | 
|---|
|  |  |  | public object DeptCheckGoodsBillList_revoke(string HInterID, string HEntryID, string User) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet dataset = new DataSet(); | 
|---|
|  |  |  | //获取车间配送单据数据 | 
|---|
|  |  |  | ds = oCN.RunProcReturn($"select * from JIT_SendGoodsBillMain a inner join JIT_SendGoodsBillSub b on a.HInterID = b.HInterID where  a.HInterID={HInterID} and HEntryID={HEntryID}  ", "JIT_SendGoodsBillMain"); | 
|---|
|  |  |  | dataset = oCN.RunProcReturn($"select * from JIT_SendGoodsBillMain a inner join JIT_SendGoodsBillSub b on a.HInterID = b.HInterID where  a.HInterID={HInterID} and HEntryID={HEntryID}  ", "JIT_SendGoodsBillMain"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var HQty = double.Parse(dataset.Tables[0].Rows[0]["HQty"].ToString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取拣料配送单的数据 | 
|---|
|  |  |  | ds = oCN.RunProcReturn($"select * from JIT_ComplementGoodsBillMain a inner join JIT_ComplementGoodsBillSub b on a.HInterID = b.HInterID where  a.HInterID={(ds.Tables[0].Rows[0]["HMainSourceInterID"].ToString())} and  b.HMaterID={(ds.Tables[0].Rows[0]["HMaterID"].ToString())} and  b.HWHID={(ds.Tables[0].Rows[0]["HWHID"].ToString())} ", "JIT_ComplementGoodsBillMain"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn($"select * from JIT_ComplementGoodsBillMain a inner join JIT_ComplementGoodsBillSub b on a.HInterID = b.HInterID where  a.HInterID={(dataset.Tables[0].Rows[0]["HMainSourceInterID"].ToString())} and  b.HMaterID={(dataset.Tables[0].Rows[0]["HMaterID"].ToString())} and  b.HWHID={(dataset.Tables[0].Rows[0]["HWHID"].ToString())} ", "JIT_ComplementGoodsBillMain"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取拣料配送单_LK表 数据 | 
|---|
|  |  |  | ds = oCN.RunProcReturn($"select * from from JIT_ComplementGoodsBillSub_LK where  HInterID={(ds.Tables[0].Rows[0]["HInterID"].ToString())} ", "JIT_SendGoodsBillMain"); | 
|---|
|  |  |  | ds = oCN.RunProcReturn($"select * from JIT_ComplementGoodsBillSub_LK where  HInterID={(ds.Tables[0].Rows[0]["HInterID"].ToString())} and HSendQTY<>0 order by HSendQTY", "JIT_SendGoodsBillMain"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //oCN.RunProc($"delete from  JIT_SendGoodsBillMain  where HInterID='{HInterID}'"); | 
|---|
|  |  |  | //oCN.RunProc($"delete from  JIT_SendGoodsBillSub  where HInterID='{HInterID}' and HEntryID={HEntryID} "); | 
|---|
|  |  |  | for (int i = 0; i < ds.Tables[0].Rows.Count; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var HSendQTY = double.Parse(ds.Tables[0].Rows[i]["HSendQTY"].ToString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //修改调拨数量 | 
|---|
|  |  |  | oCN.RunProc($"update JIT_ComplementGoodsBillSub_LK set HSendQTY=HSendQTY-{(HSendQTY > HQty ? HQty : HSendQTY)} where HInterID={ds.Tables[0].Rows[i]["HInterID"].ToString()}  and HEntryID={ds.Tables[0].Rows[i]["HEntryID"].ToString()} "); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | HQty -= HSendQTY; | 
|---|
|  |  |  | if (HQty <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dataset = oCN.RunProcReturn($"select * from JIT_SendGoodsBillMain a inner join JIT_SendGoodsBillSub b on a.HInterID = b.HInterID where  a.HInterID={HInterID} ", "JIT_SendGoodsBillMain"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //删除数据 | 
|---|
|  |  |  | if (dataset.Tables[0].Rows.Count != 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RunProc($"delete from  JIT_SendGoodsBillSub  where HInterID='{HInterID}' and HEntryID={HEntryID} "); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc($"delete from  JIT_SendGoodsBillMain  where HInterID='{HInterID}'"); | 
|---|
|  |  |  | oCN.RunProc($"delete from  JIT_SendGoodsBillSub  where HInterID='{HInterID}' and HEntryID={HEntryID} "); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|