|
@@ -779,19 +779,19 @@ public class dispatch extends Controller {
|
|
|
|
|
|
Rows rowsDispatchDetailBatchno = dbConnect.runSqlQuery("select t2.itemno,t1.batchno from sa_dispatch_items t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where ifnull(t1.batchno,'')!='' and t1.sa_dispatchid=" + sa_dispatchid);
|
|
|
|
|
|
- for(Row row :rowsDispatchDetailBatchno){
|
|
|
- JSONArray jsonArray1 =new JSONArray();
|
|
|
+ for (Row row : rowsDispatchDetailBatchno) {
|
|
|
+ JSONArray jsonArray1 = new JSONArray();
|
|
|
jsonArray1.add(row.getString("itemno"));
|
|
|
- JSONArray jsonArrayBatch = erpDocking.getErpIcinvbalBatchRowsforbatchno(20000, 1, jsonArray1,row.getString("batchno"));
|
|
|
- if(jsonArrayBatch.isEmpty()){
|
|
|
- return getErrReturnObject().setErrMsg(row.getString("itemno")+"批号有误,请重新选择!!")
|
|
|
+ JSONArray jsonArrayBatch = erpDocking.getErpIcinvbalBatchRowsforbatchno(20000, 1, jsonArray1, row.getString("batchno"));
|
|
|
+ if (jsonArrayBatch.isEmpty()) {
|
|
|
+ return getErrReturnObject().setErrMsg(row.getString("itemno") + "批号有误,请重新选择!!")
|
|
|
.toString();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (rowsMapDispatchDetailGroupByItem.containsKey(row.getString("itemno"))) {
|
|
|
if (rowsMapDispatchDetailGroupByItem.get(row.getString("itemno")).isNotEmpty()) {
|
|
|
- for(Row row1 : rowsMapDispatchDetailGroupByItem.get(row.getString("itemno"))){
|
|
|
- if(row1.getString("batchno").equals(row.getString("batchno"))){
|
|
|
- row1.put("invbalqty", ((JSONObject)jsonArrayBatch.get(0)).getBigDecimalValue("fqty"));
|
|
|
+ for (Row row1 : rowsMapDispatchDetailGroupByItem.get(row.getString("itemno"))) {
|
|
|
+ if (row1.getString("batchno").equals(row.getString("batchno"))) {
|
|
|
+ row1.put("invbalqty", ((JSONObject) jsonArrayBatch.get(0)).getBigDecimalValue("fqty"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -811,8 +811,8 @@ public class dispatch extends Controller {
|
|
|
JSONObject jsonObject = (JSONObject) obj;
|
|
|
if (rowsMapDispatchDetailGroupByItem.containsKey(jsonObject.getString("fitemno"))) {
|
|
|
if (rowsMapDispatchDetailGroupByItem.get(jsonObject.getString("fitemno")).isNotEmpty()) {
|
|
|
- for(Row row : rowsMapDispatchDetailGroupByItem.get(jsonObject.getString("fitemno"))){
|
|
|
- if(StringUtils.isBlank(row.getString("batchno"))){
|
|
|
+ for (Row row : rowsMapDispatchDetailGroupByItem.get(jsonObject.getString("fitemno"))) {
|
|
|
+ if (StringUtils.isBlank(row.getString("batchno"))) {
|
|
|
row.put("invbalqty", jsonObject.getBigDecimalValue("fqty"));
|
|
|
}
|
|
|
}
|
|
@@ -823,13 +823,13 @@ public class dispatch extends Controller {
|
|
|
for (Row row : rowsDispatchDetailGroupByItem) {
|
|
|
if (sumQtyRowsMap.containsKey(row.getString("itemno"))) {
|
|
|
RowsMap rowsMapByBatchno = sumQtyRowsMap.get(row.getString("itemno")).toRowsMap("batchno");
|
|
|
- if(rowsMapByBatchno.containsKey(row.getString("batchno"))){
|
|
|
- for(Row row1 :sumQtyRowsMap.get(row.getString("itemno"))){
|
|
|
- if(row.getString("batchno").equals(row1.getString("batchno"))){
|
|
|
+ if (rowsMapByBatchno.containsKey(row.getString("batchno"))) {
|
|
|
+ for (Row row1 : sumQtyRowsMap.get(row.getString("itemno"))) {
|
|
|
+ if (row.getString("batchno").equals(row1.getString("batchno"))) {
|
|
|
row.put("delinvbalqty", (row.containsKey("invbalqty") ? row.getBigDecimal("invbalqty") : BigDecimal.ZERO).subtract(row1.getBigDecimal("qty")));
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
row.put("delinvbalqty", row.containsKey("invbalqty") ? row.getBigDecimal("invbalqty") : BigDecimal.ZERO);
|
|
|
}
|
|
|
|
|
@@ -1077,7 +1077,11 @@ public class dispatch extends Controller {
|
|
|
sqlFactory.addParameter("qty", qty);
|
|
|
sqlFactory.addParameter("batchcontrol", 0);
|
|
|
sqlFactory.addParameter("batchno", "");
|
|
|
- sqlFactory.addParameter("remarks", row.getString("customproperties")+" 备注:"+ row.getString("remarks"));
|
|
|
+ String remarks = row.getString("customproperties");
|
|
|
+ if (!row.getString("remarks").isEmpty()) {
|
|
|
+ remarks = remarks + " 备注:" + row.getString("remarks");
|
|
|
+ }
|
|
|
+ sqlFactory.addParameter("remarks", remarks);
|
|
|
sqlFactory.addParameter("userid", userid);
|
|
|
sqlFactory.addParameter("username", username);
|
|
|
sqlList.add(sqlFactory.getSQL());
|