|
|
@@ -90,6 +90,8 @@ public class dispatch extends Controller {
|
|
|
+ sa_dispatchid);
|
|
|
if (rows.isNotEmpty()) {
|
|
|
if (rows.get(0).getString("status").equals("新建")) {
|
|
|
+ //通过版本更新发货单表头数据
|
|
|
+ Dispatch.updateDispatchWithVersion(this);
|
|
|
sqlFactory = new SQLFactory(this, "发货单更新");
|
|
|
if (sa_orderid <= 0) {
|
|
|
sqlFactory.addParameter("sa_orderid", rows.get(0).getLong("sa_orderid"));
|
|
|
@@ -239,14 +241,14 @@ public class dispatch extends Controller {
|
|
|
|
|
|
if (whereObject.containsKey("sa_orderitemsid") && !"".equals(whereObject.getString("sa_orderitemsid"))) {
|
|
|
Rows rowsDispatchid = dbConnect.runSqlQuery("select t1.sa_dispatchid from sa_dispatch_items t1 left join sa_dispatch t2 on t1.sa_dispatchid=t2.sa_dispatchid and t1.siteid=t2.siteid " +
|
|
|
- " where t2.status !='新建' and t1.siteid='"+siteid+"' and t1.sa_orderitemsid ="+whereObject.getLong("sa_orderitemsid")+"");
|
|
|
+ " where t2.status !='新建' and t1.siteid='" + siteid + "' and t1.sa_orderitemsid =" + whereObject.getLong("sa_orderitemsid") + "");
|
|
|
|
|
|
- if(rowsDispatchid.toJsonArray("sa_dispatchid").isEmpty()){
|
|
|
+ if (rowsDispatchid.toJsonArray("sa_dispatchid").isEmpty()) {
|
|
|
where.append(" and t1.sa_dispatchid in (0)");
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
String str = rowsDispatchid.toJsonArray("sa_dispatchid").toJSONString();
|
|
|
str = str.replace("[", "(").replace("]", ")");
|
|
|
- where.append(" and t1.sa_dispatchid in" ).append(str);
|
|
|
+ where.append(" and t1.sa_dispatchid in").append(str);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -430,6 +432,9 @@ public class dispatch extends Controller {
|
|
|
@CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, dispatch.class, dispatchItems.class, cashbill.class})
|
|
|
public String uncheck() throws YosException {
|
|
|
Long sa_dispatchid = content.getLong("sa_dispatchid");
|
|
|
+ //通过版本更新发货单表头数据
|
|
|
+ Dispatch.updateDispatchWithVersion(this);
|
|
|
+
|
|
|
Long sa_orderid = 0L;
|
|
|
Rows rows = dbConnect.runSqlQuery("select sa_dispatchid,status,billno,sa_orderid from sa_dispatch where sa_dispatchid ='"
|
|
|
+ sa_dispatchid + "' and siteid='" + siteid + "'");
|
|
|
@@ -477,6 +482,8 @@ public class dispatch extends Controller {
|
|
|
@CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, dispatch.class, dispatchItems.class, cashbill.class})
|
|
|
public String unclose() throws YosException {
|
|
|
Long sa_dispatchid = content.getLong("sa_dispatchid");
|
|
|
+ //通过版本更新发货单表头数据
|
|
|
+ Dispatch.updateDispatchWithVersion(this);
|
|
|
Long sa_orderid = 0L;
|
|
|
Rows rows = dbConnect.runSqlQuery("select sa_dispatchid,status,billno,sa_orderid from sa_dispatch where sa_dispatchid ='"
|
|
|
+ sa_dispatchid + "' and siteid='" + siteid + "'");
|
|
|
@@ -522,7 +529,7 @@ public class dispatch extends Controller {
|
|
|
String canCloseSainvoiceByHand = request.doPost(object1.toString(),
|
|
|
"http://60.190.151.198:8092/BYESB/jaxrs/webclientrest");
|
|
|
|
|
|
- if(!canCloseSainvoiceByHand.equals("true")){
|
|
|
+ if (!canCloseSainvoiceByHand.equals("true")) {
|
|
|
return getErrReturnObject().setErrMsg("中间表状态不为1,无法手工关闭")
|
|
|
.toString();
|
|
|
}
|
|
|
@@ -584,7 +591,7 @@ public class dispatch extends Controller {
|
|
|
contentfeek.put("billno", rows.get(0).getString("billno"));
|
|
|
objectfeek.put("content", contentfeek);
|
|
|
|
|
|
- request.doPost(objectfeek.toString(),
|
|
|
+ request.doPost(objectfeek.toString(),
|
|
|
"http://60.190.151.198:8092/BYESB/jaxrs/webclientrest");
|
|
|
|
|
|
return getSucReturnObject().toString();
|
|
|
@@ -594,6 +601,9 @@ public class dispatch extends Controller {
|
|
|
@API(title = "行关闭", apiversion = R.ID20230522093703.v1.class)
|
|
|
@CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, dispatch.class, dispatchItems.class, cashbill.class})
|
|
|
public String closeRows() throws YosException {
|
|
|
+ //通过版本更新发货单表头数据
|
|
|
+ Dispatch.updateDispatchWithVersion(this);
|
|
|
+
|
|
|
JSONArray sa_dispatch_itemsids = content.getJSONArray("sa_dispatch_itemsids");
|
|
|
BatchDeleteErr batchDeleteErr = BatchDeleteErr.create(this, sa_dispatch_itemsids.size());
|
|
|
String sql = "";
|
|
|
@@ -703,6 +713,9 @@ public class dispatch extends Controller {
|
|
|
@API(title = "复核", apiversion = R.ID20221114135803.v1.class)
|
|
|
@CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, dispatch.class, dispatchItems.class, cashbill.class})
|
|
|
public String recheck() throws YosException {
|
|
|
+ //通过版本更新发货单表头数据
|
|
|
+ Dispatch.updateDispatchWithVersion(this);
|
|
|
+
|
|
|
Long sa_dispatchid = content.getLong("sa_dispatchid");
|
|
|
Rows dispatchRows = dbConnect.runSqlQuery("select sa_dispatchid,status,billno,sa_orderid from sa_dispatch where sa_dispatchid ='"
|
|
|
+ sa_dispatchid + "' and siteid='" + siteid + "'");
|
|
|
@@ -739,16 +752,16 @@ public class dispatch extends Controller {
|
|
|
if (rowsMapDispatchDetail.containsKey(jsonObject.getString("fitemno"))) {
|
|
|
if (rowsMapDispatchDetail.get(jsonObject.getString("fitemno")).isNotEmpty()) {
|
|
|
rowsMapDispatchDetail.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", jsonObject.getBigDecimalValue("FQty"));
|
|
|
- }else{
|
|
|
- rowsMapDispatchDetail.get(jsonObject.getString("fitemno")).get(0).put("invbalqty",0);
|
|
|
+ } else {
|
|
|
+ rowsMapDispatchDetail.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", 0);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (!rowsDispatchDetail.isEmpty()) {
|
|
|
for (Row row : rowsDispatchDetail) {
|
|
|
- System.out.println(Parameter.get(siteid,"dispatchinstock"));
|
|
|
- System.out.println(Parameter.get(siteid,"dispatchinstock").equals("1"));
|
|
|
+ System.out.println(Parameter.get(siteid, "dispatchinstock"));
|
|
|
+ System.out.println(Parameter.get(siteid, "dispatchinstock").equals("1"));
|
|
|
if (rowsMap.get(row.getString("sa_orderitemsid")).isEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("行号为:【" + row.getString("rowno") + "】的发货单明细不存在对应得订单行,无法复核")
|
|
|
.toString();
|
|
|
@@ -758,7 +771,7 @@ public class dispatch extends Controller {
|
|
|
.toString();
|
|
|
}
|
|
|
|
|
|
- if(Parameter.get(siteid,"dispatchinstock").equals("1")){
|
|
|
+ if (Parameter.get(siteid, "dispatchinstock").equals("1")) {
|
|
|
if (row.getBigDecimal("qty").compareTo(row.getBigDecimal("invbalqty")) > 0) {
|
|
|
return getErrReturnObject().setErrMsg("行号为:【" + row.getString("rowno") + "】的发货单明细的数量大于erp的库存数量,无法复核")
|
|
|
.toString();
|
|
|
@@ -766,7 +779,6 @@ public class dispatch extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
sqlList.add("update sa_orderitems set undeliqty=" + rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("undeliqty").subtract(row.getBigDecimal("qty")) + ",deliedqty=" + (row.getBigDecimal("qty").add(rowsMap.get(row.getLong("sa_orderitemsid")).get(0).getBigDecimal("deliedqty"))) + " where sa_orderitemsid=" + row.getLong("sa_orderitemsid"));
|
|
|
}
|
|
|
} else {
|
|
|
@@ -827,6 +839,8 @@ public class dispatch extends Controller {
|
|
|
@API(title = "反复核", apiversion = R.ID20230720152503.v1.class)
|
|
|
@CACHEING_CLEAN(apiClass = {Order.class, OrderItems.class, restcontroller.sale.order.Order.class, dispatch.class, dispatchItems.class, cashbill.class})
|
|
|
public String unrecheck() throws YosException {
|
|
|
+ //通过版本更新发货单表头数据
|
|
|
+ Dispatch.updateDispatchWithVersion(this);
|
|
|
Long sa_dispatchid = content.getLong("sa_dispatchid");
|
|
|
Rows dispatchRows = dbConnect.runSqlQuery("select sa_dispatchid,status,billno,sa_orderid,sys_enterpriseid from sa_dispatch where sa_dispatchid ='"
|
|
|
+ sa_dispatchid + "' and siteid='" + siteid + "'");
|