|
@@ -647,6 +647,108 @@ public class stockbill extends Controller {
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
+ @API(title = "红冲", apiversion = R.ID2025072409344603.v1.class)
|
|
|
+ @CACHEING_CLEAN(apiClass = {stockbill.class, stockbillitems.class})
|
|
|
+ public String hongc() throws YosException {
|
|
|
+ long st_stockbillid=content.getLong("st_stockbillid");
|
|
|
+ ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select t1.*,ifnull(t2.sa_sendrepairid,0) sa_sendrepairid from st_stockbill t1 left join sa_sendrepair t2 on t1.st_stockbillid=t2.sourceid and t1.siteid=t2.siteid and t2.sourcetable='st_stockbill' where t1.st_stockbillid ='"
|
|
|
+ + st_stockbillid + "' and t1.siteid='" + siteid + "'");
|
|
|
+ Rows rowsdetail = dbConnect.runSqlQuery("select t1.*,t2.skucontrol from st_stockbill_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid where t1.st_stockbillid ='"
|
|
|
+ + st_stockbillid + "' and t1.siteid='" + siteid + "'");
|
|
|
+ if(rows.isEmpty()){
|
|
|
+ return getErrReturnObject().setErrMsg("该出入库单不存在")
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
+ if(!rows.get(0).getString("status").equals("审核")){
|
|
|
+ return getErrReturnObject().setErrMsg("非审核的出入库单无法红冲")
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
+ if(rows.get(0).getInteger("rb")==0){
|
|
|
+ return getErrReturnObject().setErrMsg("只能红冲蓝字出入库单")
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
+ if(rows.get(0).getInteger("sa_sendrepairid")!=0){
|
|
|
+ return getErrReturnObject().setErrMsg("来源于送修单的出库单不能红冲")
|
|
|
+ .toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ st_stockbillid = createTableID("st_stockbill");
|
|
|
+ InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "st_stockbill");
|
|
|
+ insertSQL.setUniqueid(st_stockbillid);
|
|
|
+ insertSQL.setSiteid(siteid);
|
|
|
+ insertSQL.setValue("sys_enterpriseid", rows.get(0).getLong("sys_enterpriseid"));
|
|
|
+ insertSQL.setValue("rec_contactsid", rows.get(0).getLong("rec_contactsid"));
|
|
|
+ insertSQL.setValue("departmentid", rows.get(0).getLong("departmentid"));
|
|
|
+ insertSQL.setValue("stockid", rows.get(0).getLong("stockid"));
|
|
|
+ insertSQL.setValue("type", rows.get(0).getString("type"));
|
|
|
+ insertSQL.setValue("typemx", rows.get(0).getString("typemx"));
|
|
|
+ insertSQL.setValue("sa_supplierid", rows.get(0).getLong("sa_supplierid"));
|
|
|
+ insertSQL.setValue("rb", 0);
|
|
|
+ insertSQL.setValue("remarks", rows.get(0).getString("remarks"));
|
|
|
+ insertSQL.setValue("billdate", getDateTime_Str());
|
|
|
+ insertSQL.setValue("billno", createBillCode("stockbill"));
|
|
|
+ insertSQL.setValue("outplace", rows.get(0).getString("outplace"));
|
|
|
+ insertSQL.setValue("delivery", rows.get(0).getString("delivery"));
|
|
|
+ insertSQL.setValue("invoice_enterprisename", rows.get(0).getString("invoice_enterprisename"));
|
|
|
+ insertSQL.setValue("invoice_address", rows.get(0).getString("invoice_address"));
|
|
|
+ insertSQL.setValue("invoice_taxno", rows.get(0).getString("invoice_taxno"));
|
|
|
+ insertSQL.setValue("tracknumber", rows.get(0).getString("tracknumber"));
|
|
|
+ insertSQL.setValue("isconfirm", rows.get(0).getString("isconfirm"));
|
|
|
+
|
|
|
+ insertSQL.setValue("sourceobject", "st_stockbill");
|
|
|
+ insertSQL.setValue("sourceid", rows.get(0).getLong("st_stockbillid"));
|
|
|
+
|
|
|
+ insertSQL.setValue("period", rows.get(0).getString("period"));
|
|
|
+
|
|
|
+ insertSQL.setValue("createby", username);
|
|
|
+ insertSQL.setDateValue("createdate");
|
|
|
+ insertSQL.setValue("changeby", username);
|
|
|
+ insertSQL.setDateValue("changedate");
|
|
|
+ insertSQL.setValue("status", "新建");
|
|
|
+ insertSQL.setValue("payamount", 0);
|
|
|
+ insertSQL.setValue("paydiscountamount", 0);
|
|
|
+ sqlList.add(insertSQL.getSQL());
|
|
|
+
|
|
|
+ int i = 0;
|
|
|
+ for(Row row : rowsdetail){
|
|
|
+ InsertSQL insertDetailSQL= SQLFactory.createInsertSQL(this, "st_stockbill_items");
|
|
|
+ insertDetailSQL.setUniqueid(createTableID("st_stockbill_items"));
|
|
|
+ insertDetailSQL.setSiteid(siteid);
|
|
|
+ insertDetailSQL.setValue("rowno", i + 1);
|
|
|
+ insertDetailSQL.setValue("st_stockbillid", st_stockbillid);
|
|
|
+ insertDetailSQL.setValue("sa_orderitemsid", row.getLong("sa_orderitemsid"));
|
|
|
+ insertDetailSQL.setValue("itemid", row.getString("itemid"));
|
|
|
+ insertDetailSQL.setValue("sa_orderid", row.getString("sa_orderid"));
|
|
|
+ insertDetailSQL.setValue("qty", row.getString("qty"));
|
|
|
+ insertDetailSQL.setValue("discountrate", row.getBigDecimal("discountrate"));
|
|
|
+ insertDetailSQL.setValue("sa_dispatch_itemsid", 0);
|
|
|
+ insertDetailSQL.setValue("defaultprice", row.getBigDecimal("defaultprice"));
|
|
|
+ insertDetailSQL.setValue("remarks", row.getString("remarks"));
|
|
|
+ insertDetailSQL.setValue("sku", row.getString("sku"));
|
|
|
+ insertDetailSQL.setValue("itemno", row.getString("itemno"));
|
|
|
+ insertDetailSQL.setValue("itemname", row.getString("itemname"));
|
|
|
+ insertDetailSQL.setValue("model", row.getString("model"));
|
|
|
+ insertDetailSQL.setValue("price", row.getBigDecimal("price"));
|
|
|
+ insertDetailSQL.setValue("stockid", row.getString("stockid"));
|
|
|
+ insertDetailSQL.setValue("amount", row.getBigDecimal("qty").multiply(row.getBigDecimal("price")));
|
|
|
+ insertDetailSQL.setValue("untaxedprice", row.getBigDecimal("price").divide(new BigDecimal(1.13),2, BigDecimal.ROUND_HALF_UP));
|
|
|
+ insertDetailSQL.setValue("untaxedamount", row.getBigDecimal("qty").multiply(row.getBigDecimal("price").divide(new BigDecimal(1.13),2, BigDecimal.ROUND_HALF_UP)));
|
|
|
+
|
|
|
+ insertDetailSQL.setValue("sourceid", row.getLong("st_stockbill_itemsid"));
|
|
|
+ insertDetailSQL.setValue("sourceobject", "st_stockbill_items");
|
|
|
+ sqlList.add(insertDetailSQL.getSQL());
|
|
|
+ }
|
|
|
+
|
|
|
+ sqlList.add(DataContrlLog.createLog(this, "st_stockbill", st_stockbillid, "新增", "销售出库单新增成功").getSQL());
|
|
|
+
|
|
|
+ dbConnect.runSqlUpdate(sqlList);
|
|
|
+ content.put("st_stockbillid", st_stockbillid);
|
|
|
+
|
|
|
+
|
|
|
+ return queryStockbillMain();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@API(title = "更新站点信息详情详情", apiversion = R.ID20230720143503.v1.class)
|
|
|
public String updateParameterSiteInfo() throws YosException {
|