合同状态同步

This commit is contained in:
lihao 2025-05-26 18:42:53 +08:00
parent 3bfb0429a0
commit 7ed12f2025
1 changed files with 15 additions and 5 deletions

View File

@ -79,6 +79,7 @@ public class ClosesoUpdateBL extends AbstractNCCRestResource {
public JSONString ClosesoUpdateBL(JSONString json) { public JSONString ClosesoUpdateBL(JSONString json) {
JSONObject errojson = new JSONObject(); JSONObject errojson = new JSONObject();
Set<String> vbillcodes = new HashSet<>(); Set<String> vbillcodes = new HashSet<>();
Set<String> billcodes = new HashSet<>();
// 创建map 9-冻结 10-办结 11-终止 8生效(取消冻结) // 创建map 9-冻结 10-办结 11-终止 8生效(取消冻结)
Map<String, String> operationMap = new HashMap<>(); Map<String, String> operationMap = new HashMap<>();
@ -136,9 +137,8 @@ public JSONString ClosesoUpdateBL(JSONString json) {
" SET h.vdef1 = '" + operationId + "' "+ " SET h.vdef1 = '" + operationId + "' "+
" WHERE EXISTS (" + " WHERE EXISTS (" +
" SELECT 1" + " SELECT 1" +
" FROM so_saleorder_b b" + " FROM bd_defdoc hbd "+
" left join bd_defdoc hbd on hbd.pk_defdoc=b.vbdef1 "+ " WHERE hbd.pk_defdoc=h.VDEF6" +
" WHERE b.csaleorderid = h.csaleorderid" +
" AND hbd.code = '" + vctcode + "' " + " AND hbd.code = '" + vctcode + "' " +
" );"; " );";
@ -153,10 +153,10 @@ public JSONString ClosesoUpdateBL(JSONString json) {
return ResultMessageUtil.exceptionToJSON(new NullPointerException("vctcode:null")); return ResultMessageUtil.exceptionToJSON(new NullPointerException("vctcode:null"));
} }
// 根据组织ID和销售订单代码获取销售订单的唯一标识 // 根据组织ID和销售订单代码获取销售订单的唯一标识
String sql = " select h.csaleorderid,b.csaleorderbid,h.ts,hbd.code as vbillcode,o.code as pk_org from so_saleorder h " String sql = " select h.csaleorderid,b.csaleorderbid,h.ts,hbd.code as vbillcode,o.code as pk_org,h.vbillcode as billcode from so_saleorder h "
+ "left join so_saleorder_b b on h.csaleorderid=b.csaleorderid " + "left join so_saleorder_b b on h.csaleorderid=b.csaleorderid "
+ "left join org_salesorg o on h.pk_org=o.pk_salesorg " + "left join org_salesorg o on h.pk_org=o.pk_salesorg "
+" left join bd_defdoc hbd on hbd.pk_defdoc=b.vbdef1 "+ +" left join bd_defdoc hbd on hbd.pk_defdoc=h.VDEF6 "+
"where hbd.code='" + vctcode + "' "; "where hbd.code='" + vctcode + "' ";
List<Object[]> result = (List<Object[]>) getQueryService().executeQuery(sql, new ArrayListProcessor()); List<Object[]> result = (List<Object[]>) getQueryService().executeQuery(sql, new ArrayListProcessor());
@ -175,9 +175,11 @@ public JSONString ClosesoUpdateBL(JSONString json) {
String ts = (String) row[2]; String ts = (String) row[2];
bidsList.add(csaleorderbid + "," + ts); bidsList.add(csaleorderbid + "," + ts);
String vbillcode = (String) row[3]; String vbillcode = (String) row[3];
String billcode = (String) row[5];
if (vbillcode != null) { if (vbillcode != null) {
pk_org=(String)row[4]; pk_org=(String)row[4];
vbillcodes.add(vbillcode); vbillcodes.add(vbillcode);
billcodes.add(billcode);
} }
} }
} }
@ -239,6 +241,14 @@ public JSONString ClosesoUpdateBL(JSONString json) {
int succState = updateSaleBSQty(updateSql.toString()); int succState = updateSaleBSQty(updateSql.toString());
for (String vbillcode : billcodes){
// ¸üÐÂÁ÷³ÌÉú²ú©µ¥
String updateSql1 = " UPDATE mm_mo h" +
" SET h.vdef5 = '" + operationId + "' "+
" WHERE h.vsrccode = '" + vbillcode + "' " +
" ;";
updateSaleBSQty(updateSql1.toString());
}
// 如果操作成功设置错误JSON对象的code为0表示成功 // 如果操作成功设置错误JSON对象的code为0表示成功
errojson.put("status", "1"); errojson.put("status", "1");
errojson.put("message", "销售订单状态修改了"+succState+"条,"+ret2); errojson.put("message", "销售订单状态修改了"+succState+"条,"+ret2);