|
|
@@ -82,6 +82,7 @@ public class sendplandetail extends Controller {
|
|
|
" group by t2.itemid ");
|
|
|
Rows invbalrows = dbConnect.runSqlQuery("select itemid,sum(qty) qty from st_invbal t1 group by itemid");
|
|
|
Rows sendplandetails = dbConnect.runSqlQuery("select t1.sa_sendplandetailid,t1.sa_orderid,t2.itemid,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=" + sa_sendplanid + " and t1.siteid='" + siteid + "'");
|
|
|
+
|
|
|
RowsMap stockbillrowsMap = stockbillrows.toRowsMap("itemid");
|
|
|
RowsMap invbalrowsMap = invbalrows.toRowsMap("itemid");
|
|
|
for (Row row : sendplandetails) {
|
|
|
@@ -118,7 +119,21 @@ public class sendplandetail extends Controller {
|
|
|
for (Row row : rows1) {
|
|
|
list.add("update sa_sendplandetail set colorflag=1 where sa_sendplanid=" + sa_sendplanid + " and sa_orderid =" + row.getLong("sa_orderid"));
|
|
|
}
|
|
|
+
|
|
|
+ Rows sendplandetailsgroupitemid = dbConnect.runSqlQuery("select t2.itemid,count(1) count 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=" + sa_sendplanid + " and t1.siteid='" + siteid + "' group by t2.itemid HAVING COUNT(1) > 1");
|
|
|
+ RowsMap sendplandetailsrowsMap =sendplandetails.toRowsMap("itemid");
|
|
|
+ for(Row row :sendplandetailsgroupitemid){
|
|
|
+ if(sendplandetailsrowsMap.containsKey(row.getString("itemid"))){
|
|
|
+ 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"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
dbConnect.runSqlUpdate(list);
|
|
|
+
|
|
|
+
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|