|
|
@@ -16,7 +16,6 @@ import common.annotation.CACHEING;
|
|
|
import common.annotation.CACHEING_CLEAN;
|
|
|
import common.data.*;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
-import org.apache.poi.hssf.record.DVALRecord;
|
|
|
import restcontroller.R;
|
|
|
import restcontroller.webmanage.sale.order.Order;
|
|
|
import restcontroller.webmanage.sale.order.OrderItems;
|
|
|
@@ -309,6 +308,10 @@ public class stockbill extends Controller {
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "st_dbstockbill", "t9", "t1.sourceid=t9.st_dbstockbillid and t1.siteid = t9.siteid and t1.sourceobject='st_dbstockbill'");
|
|
|
querySQL.addQueryFields("dbbillno", "t9.billno");
|
|
|
}
|
|
|
+ if (billtypes.contains("返修出库")) {
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sa_sendrepair", "t10", "t10.sourceid=t1.st_stockbillid and t10.siteid = t1.siteid and t10.sourcetable='st_stockbill'","instockdate");
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
querySQL.setWhere("t1.siteid", siteid);
|
|
|
@@ -318,6 +321,8 @@ public class stockbill extends Controller {
|
|
|
querySQL.setPage(pageSize, pageNumber);
|
|
|
Rows rows = querySQL.query();
|
|
|
|
|
|
+
|
|
|
+
|
|
|
ArrayList<Long> ids = rows.toArrayList("st_stockbillid", new ArrayList<>());
|
|
|
HashMap<Long, Integer> reportMap =Report.getViewCount(this,"st_stockbill",ids);
|
|
|
for(Row row :rows){
|
|
|
@@ -325,6 +330,19 @@ public class stockbill extends Controller {
|
|
|
row.put("printcount",reportMap.get(row.getLong("st_stockbillid")));
|
|
|
}
|
|
|
}
|
|
|
+ if(billtypes.contains("返修出库")){
|
|
|
+ QuerySQL querySQLDatail = SQLFactory.createQuerySQL(this, "st_stockbill_items", "st_stockbillid").setTableAlias("t1");
|
|
|
+ querySQLDatail.addJoinTable(JOINTYPE.left, "st_stockbill_items_sku", "t2", "t1.st_stockbill_itemsid=t2.st_stockbill_itemsid and t1.siteid = t2.siteid ","sku");
|
|
|
+ querySQLDatail.addJoinTable(JOINTYPE.left, "plm_item", "t3", "t3.itemid=t1.itemid and t3.siteid = t1.siteid ","itemno","itemname","spec","model");
|
|
|
+ querySQLDatail.setWhere("t1.st_stockbillid",ids);
|
|
|
+ Rows rowsdatail = querySQLDatail.query();
|
|
|
+ RowsMap rowsdatailMap = rowsdatail.toRowsMap("st_stockbillid");
|
|
|
+ for(Row row :rows){
|
|
|
+ if(rowsdatailMap.containsKey(row.getString("st_stockbillid"))){
|
|
|
+ row.put("itemskus",rowsdatailMap.get(row.getString("st_stockbillid")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
@@ -884,8 +902,7 @@ public class stockbill extends Controller {
|
|
|
if (skustockid == 0 && stockid == 0) {
|
|
|
return getErrReturnObject().setErrMsg("请指定仓库").toString();
|
|
|
}
|
|
|
- if (st_stockbill.getString("status").equals("审核")
|
|
|
- && !stockbillitemsrows.toRowsMap("skucontrol").get("1").toRowsMap("itemid").containsKey(
|
|
|
+ if (!stockbillitemsrows.toRowsMap("skucontrol").get("1").toRowsMap("itemid").containsKey(
|
|
|
skuRowsMap.get(FMACHINECODE).get(0).getString("itemid"))) {
|
|
|
return getErrReturnObject().setErrMsg("序列号所属的商品编号没有包含在单据表体中").toString();
|
|
|
}
|
|
|
@@ -913,6 +930,11 @@ public class stockbill extends Controller {
|
|
|
: skuRowsMap.get(FMACHINECODE).get(0).getString("stockno");
|
|
|
Rows stockrows = dbConnect.runSqlQuery("select *from st_stock where stockno='" + stockno + "'");
|
|
|
|
|
|
+
|
|
|
+ if(st_stockbill_itemsid>0 && dbConnect.runSqlQuery("select 1 from where st_stockbill_items_sku where st_stockbillid=st_stockbill_itemsid and st_stockbillid="+st_stockbillid).size()>0){
|
|
|
+ scanqtyrefresh();
|
|
|
+ }
|
|
|
+
|
|
|
InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "st_stockbill_items_sku");
|
|
|
long st_stockbill_items_skuid = createTableID("st_stockbill_items_sku");
|
|
|
insertSQL.setUniqueid(st_stockbill_items_skuid);
|
|
|
@@ -923,11 +945,13 @@ public class stockbill extends Controller {
|
|
|
if (stockid == 0) {
|
|
|
skustockid = st_stockbill.getLong("stockid");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
insertSQL.setValue("stockid", skustockid);
|
|
|
insertSQL.setValue("itemid", skuitemid);
|
|
|
insertSQL.setValue("sku", FMACHINECODE);
|
|
|
insertSQL.setValue("st_stockbillid", st_stockbillid);
|
|
|
- insertSQL.setValue("st_stockbill_itemsid", st_stockbill_itemsid);
|
|
|
+ insertSQL.setValue("st_stockbill_itemsid", st_stockbill_itemsid==0?st_stockbillid:st_stockbill_itemsid);
|
|
|
sqllist.add(insertSQL.getSQL());
|
|
|
if (st_stockbill.getString("status").equals("审核")) {
|
|
|
if (isinstock(st_stockbill.getString("type"), st_stockbill.getString("rb"), true)) {
|
|
|
@@ -952,6 +976,27 @@ public class stockbill extends Controller {
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
+ @API(title = "扫描数量刷新", apiversion = R.ID2025102215584903.v1.class)
|
|
|
+ @CACHEING_CLEAN(apiClass = {stockbill.class, stockbillitems.class, stockbillitemssku.class})
|
|
|
+ public String scanqtyrefresh() throws YosException {
|
|
|
+ long st_stockbillid = content.getLong("st_stockbillid");
|
|
|
+ ArrayList<String> sqllist = new ArrayList<>();
|
|
|
+ Rows stockbillskuRows = dbConnect.runSqlQuery("select t1.sku,t2.itemid,t1.st_stockbill_items_skuid from st_stockbill_items_sku t1 left join sa_itemsku t2 on t1.sku=t2.sku where t1.st_stockbillid=t1.st_stockbill_itemsid and t1.st_stockbillid="+st_stockbillid);
|
|
|
+ Rows stockbilldetailRows = dbConnect.runSqlQuery("select t1.itemid,t1.st_stockbill_itemsid from st_stockbill_items t1 where t1.st_stockbillid="+st_stockbillid);
|
|
|
+ RowsMap stockbilldetailRowsMap = stockbilldetailRows.toRowsMap("itemid");
|
|
|
+ for(Row row :stockbillskuRows){
|
|
|
+ String itemid = row.getString("itemid");
|
|
|
+ long st_stockbill_items_skuid =row.getLong("st_stockbill_items_skuid");
|
|
|
+ if(stockbilldetailRowsMap.containsKey(itemid)){
|
|
|
+ sqllist.add("update st_stockbill_items_sku set st_stockbill_itemsid="+stockbilldetailRowsMap.get(itemid).get(0).getLong("st_stockbill_itemsid")+" where st_stockbill_items_skuid="+st_stockbill_items_skuid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ dbConnect.runSqlUpdate(sqllist);
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@API(title = "更新站点信息详情详情", apiversion = R.ID20230720143503.v1.class)
|
|
|
public String updateParameterSiteInfo() throws YosException {
|