|
|
@@ -100,16 +100,23 @@ public class dbstockbillreceive extends Controller {
|
|
|
if (recqty > undeliqty) {
|
|
|
return getErrReturnObject().setErrMsg("收货确认数量不能大于未入库数量").toString();
|
|
|
}
|
|
|
- if (jsonObject.getJSONArray("skuinfos").size() > 0) {
|
|
|
- if (recqty != jsonObject.getJSONArray("skuinfos").size()) {
|
|
|
- return getErrReturnObject().setErrMsg("机器码数量与收货确认数量不匹配").toString();
|
|
|
- }
|
|
|
+ if (!jsonObject.getJSONArray("skuinfos").isEmpty() && recqty != jsonObject.getJSONArray("skuinfos").size()) {
|
|
|
+ return getErrReturnObject().setErrMsg("机器码数量与收货确认数量不匹配").toString();
|
|
|
}
|
|
|
- Rows skurows = dbConnect.runSqlQuery("select * from sa_itemsku where siteid='" + siteid + "' and ifnull(st_dbstockbillid,0)>0 ");
|
|
|
- RowsMap skuRowsMap = skurows.toRowsMap("sku");
|
|
|
+
|
|
|
+ ArrayList<String> recskus = new ArrayList<>();
|
|
|
for (Object skuinfo : jsonObject.getJSONArray("skuinfos")) {
|
|
|
- if (!skuRowsMap.containsKey(((JSONObject) skuinfo).getString("sku"))) {
|
|
|
- return getErrReturnObject().setErrMsg("序列号" + ((JSONObject) skuinfo).getString("sku") + "不存在或者已经确认收货").toString();
|
|
|
+ recskus.add(((JSONObject) skuinfo).getString("sku"));
|
|
|
+ }
|
|
|
+ QuerySQL itemskuQuery = SQLFactory.createQuerySQL(this, "sa_itemsku", "sku");
|
|
|
+ itemskuQuery.setSiteid(siteid);
|
|
|
+ itemskuQuery.setWhere("ifnull(st_dbstockbillid,0)>0");
|
|
|
+ itemskuQuery.setWhere("sku", recskus);
|
|
|
+ ArrayList<String> skus = itemskuQuery.query().toArrayList("sku");
|
|
|
+
|
|
|
+ for (String sku : recskus) {
|
|
|
+ if (!skus.contains(sku)) {
|
|
|
+ return getErrReturnObject().setErrMsg("序列号" + sku + "不存在或者已经确认收货").toString();
|
|
|
}
|
|
|
}
|
|
|
|