|
|
@@ -124,10 +124,12 @@ public class sendplandetail extends Controller {
|
|
|
RowsMap sendplandetailsrowsMap =sendplandetails.toRowsMap("itemid");
|
|
|
for(Row row :sendplandetailsgroupitemid){
|
|
|
if(sendplandetailsrowsMap.containsKey(row.getString("itemid"))){
|
|
|
+ BigDecimal sendqty=BigDecimal.ZERO;
|
|
|
for(int a=0; a<sendplandetailsrowsMap.get(row.getString("itemid")).size();a++){
|
|
|
if(a>0){
|
|
|
- list.add("update sa_sendplandetail set canuseqty=canuseqty-"+a+" where sa_sendplandetailid="+sendplandetailsrowsMap.get(row.getString("itemid")).get(a).getLong("sa_sendplandetailid"));
|
|
|
+ list.add("update sa_sendplandetail set canuseqty=canuseqty-"+sendqty+" where sa_sendplandetailid="+sendplandetailsrowsMap.get(row.getString("itemid")).get(a).getLong("sa_sendplandetailid"));
|
|
|
}
|
|
|
+ sendqty=sendqty.add(sendplandetailsrowsMap.get(row.getString("itemid")).get(a).getBigDecimal("sendqty"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -151,7 +153,23 @@ public class sendplandetail extends Controller {
|
|
|
long sa_sendplandetailid = content.getLong("sa_sendplandetailid");
|
|
|
BigDecimal sendqty = content.getBigDecimal("sendqty");
|
|
|
String outplace= content.getString("outplace");
|
|
|
+ Rows sendplandetails = dbConnect.runSqlQuery("select t2.itemid,t1.sa_sendplanid from sa_sendplandetail t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid where t1.sa_sendplandetailid=" + sa_sendplandetailid + " and t1.siteid='" + siteid + "'");
|
|
|
+ if(sendplandetails.isEmpty()){
|
|
|
+ return getErrReturnObject().setErrMsg("发货计划明细不存在").toString();
|
|
|
+ }
|
|
|
+
|
|
|
dbConnect.runSqlUpdate("update sa_sendplandetail set sendqty=" + sendqty + ",outplace='"+outplace+"' where sa_sendplandetailid=" + sa_sendplandetailid);
|
|
|
+
|
|
|
+
|
|
|
+ ArrayList<String> list = new ArrayList<>();
|
|
|
+ Rows sendplandetailsgroupitemid = dbConnect.runSqlQuery("select t2.itemid,t1.sa_sendplandetailid,t1.sendqty from sa_sendplandetail t1 inner join sa_orderitems t2 on t1.sa_orderitemsid=t2.sa_orderitemsid and t1.siteid=t2.siteid where t1.sa_sendplanid=" + sendplandetails.get(0).getLong("sa_sendplanid") + " and t2.itemid="+sendplandetails.get(0).getLong("itemid")+" and t1.siteid='" + siteid + "'");
|
|
|
+ BigDecimal sendqtyold = BigDecimal.ZERO;
|
|
|
+ for(int a=0; a<sendplandetailsgroupitemid.size();a++){
|
|
|
+ if(a>0){
|
|
|
+ list.add("update sa_sendplandetail set canuseqty=canuseqty-"+sendqtyold+" where sa_sendplandetailid="+sendplandetailsgroupitemid.get(a).getLong("sa_sendplandetailid"));
|
|
|
+ }
|
|
|
+ sendqtyold=sendqtyold.add(sendplandetailsgroupitemid.get(a).getBigDecimal("sendqty"));
|
|
|
+ }
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|