|
@@ -362,6 +362,223 @@ public class Item extends Controller {
|
|
|
return queryDetail();
|
|
return queryDetail();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @API(title = "商品复制", apiversion = R.ID2025101409071403.v1.class)
|
|
|
|
|
+ public String copyItem() throws YosException {
|
|
|
|
|
+ long itemid = content.getLong("itemid");
|
|
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "货品档案新增");
|
|
|
|
|
+ ArrayList<String> sqlList=new ArrayList<>();
|
|
|
|
|
+ Rows itemRows = dbConnect.runSqlQuery("select *from plm_item where itemid="+itemid);
|
|
|
|
|
+ Rows itemextendRows = dbConnect.runSqlQuery("select *from plm_itemextend where itemid="+itemid);
|
|
|
|
|
+ Rows itemtradefieldRows = dbConnect.runSqlQuery("select *from plm_item_tradefield where itemid="+itemid);
|
|
|
|
|
+ Rows itemsaleclassRows = dbConnect.runSqlQuery("select *from sa_itemsaleclass where itemid="+itemid);
|
|
|
|
|
+ Rows attachmentLinksRows = dbConnect.runSqlQuery("select * from sys_attachment_links where ownertable='plm_item' and ownerid="+itemid);
|
|
|
|
|
+
|
|
|
|
|
+ if(itemRows.isEmpty()){
|
|
|
|
|
+ return getErrReturnObject().setErrMsg("原商品不存在,无法复制").toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ Row item = itemRows.get(0);
|
|
|
|
|
+ long newitemid = createTableID("plm_item");
|
|
|
|
|
+ sqlList.add(DataContrlLog.createLog(this, "plm_item", newitemid, "新增", "新增商品" + item.getString("itemname")).getSQL());
|
|
|
|
|
+
|
|
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
|
|
+ sqlFactory.addParameter("itemid", newitemid);
|
|
|
|
|
+ sqlFactory.addParameter("username", username);
|
|
|
|
|
+ sqlFactory.addParameter("userid", userid);
|
|
|
|
|
+ sqlFactory.addParameter("itemno", "复制"+item.getString("itemno"));
|
|
|
|
|
+ sqlFactory.addParameter("unitid", item.getLong("unitid"));
|
|
|
|
|
+ sqlFactory.addParameter("isauxunit", item.getString("isauxunit"));
|
|
|
|
|
+ sqlFactory.addParameter("unitgroupid", item.getString("unitgroupid"));
|
|
|
|
|
+
|
|
|
|
|
+ sqlFactory.addParameter("itemname", item.getString("itemname"));
|
|
|
|
|
+ sqlFactory.addParameter("isonsale", 0);
|
|
|
|
|
+ sqlFactory.addParameter("model", item.getString("model"));
|
|
|
|
|
+ sqlFactory.addParameter("spec", item.getString("spec"));
|
|
|
|
|
+ // 订单起订量
|
|
|
|
|
+ sqlFactory.addParameter("orderminqty", item.getBigDecimal("orderminqty"));
|
|
|
|
|
+ // 订单增量
|
|
|
|
|
+ sqlFactory.addParameter("orderaddqty", item.getBigDecimal("orderaddqty"));
|
|
|
|
|
+ // 订单起订量控制单位(0:主单位;1:辅助单位)
|
|
|
|
|
+ sqlFactory.addParameter("orderminqty_auxunit", item.getString("orderminqty_auxunit"));
|
|
|
|
|
+ // 订单增量控制单位(0:主单位;1:辅助单位)
|
|
|
|
|
+ sqlFactory.addParameter("orderaddqty_auxunit", item.getString("orderaddqty_auxunit"));
|
|
|
|
|
+ // 说明
|
|
|
|
|
+ sqlFactory.addParameter("remarks", item.getString("remarks"));
|
|
|
|
|
+ // 商品条形码
|
|
|
|
|
+ sqlFactory.addParameter("barcode", item.getString("barcode"));
|
|
|
|
|
+ // 是否单品管理
|
|
|
|
|
+ sqlFactory.addParameter("skucontrol", item.getBoolean("skucontrol"));
|
|
|
|
|
+ // 是否批次管理
|
|
|
|
|
+ sqlFactory.addParameter("batchcontrol", item.getBoolean("batchcontrol"));
|
|
|
|
|
+ // 毛重(g)
|
|
|
|
|
+ sqlFactory.addParameter("grossweight", item.getLong("grossweight"));
|
|
|
|
|
+ // 净重(g)
|
|
|
|
|
+ sqlFactory.addParameter("weight", item.getLong("weight"));
|
|
|
|
|
+ // 高度(mm)
|
|
|
|
|
+ sqlFactory.addParameter("height", item.getLong("height"));
|
|
|
|
|
+ // 宽度(mm)
|
|
|
|
|
+ sqlFactory.addParameter("width", item.getLong("width"));
|
|
|
|
|
+ // 长度(mm)
|
|
|
|
|
+ sqlFactory.addParameter("length", item.getLong("length"));
|
|
|
|
|
+ // 交期
|
|
|
|
|
+ sqlFactory.addParameter("delivery", item.getLong("delivery"));
|
|
|
|
|
+ // 牌价
|
|
|
|
|
+ sqlFactory.addParameter("marketprice", item.getBigDecimal("marketprice"));
|
|
|
|
|
+ // 是否工具
|
|
|
|
|
+ sqlFactory.addParameter("istool", item.getBoolean("istool"));
|
|
|
|
|
+ // 产品标准
|
|
|
|
|
+ sqlFactory.addParameter("standards", item.getString("standards"));
|
|
|
|
|
+ // 库存缺货标准
|
|
|
|
|
+ sqlFactory.addParameter("stockstatus2", item.getInteger("stockstatus2"));
|
|
|
|
|
+ // 库存充足标准
|
|
|
|
|
+ sqlFactory.addParameter("stockstatus1", item.getInteger("stockstatus1"));
|
|
|
|
|
+ // 保修期(年)
|
|
|
|
|
+ sqlFactory.addParameter("warrantyday", item.getInteger("warrantyday"));
|
|
|
|
|
+ // 是否营销物料
|
|
|
|
|
+ sqlFactory.addParameter("iswuliao", item.getBoolean("iswuliao"));
|
|
|
|
|
+ // 是否服务物料
|
|
|
|
|
+ sqlFactory.addParameter("isservice", item.getBoolean("isservice"));
|
|
|
|
|
+
|
|
|
|
|
+ sqlFactory.addParameter("marketingcategory", item.getString("marketingcategory"));
|
|
|
|
|
+
|
|
|
|
|
+ sqlFactory.addParameter("color", item.getString("color"));
|
|
|
|
|
+ //边框(德莱宝中为工艺)
|
|
|
|
|
+ sqlFactory.addParameter("cheek", item.getString("cheek"));
|
|
|
|
|
+ sqlFactory.addParameter("delistingstatus", item.getString("delistingstatus"));
|
|
|
|
|
+
|
|
|
|
|
+ sqlFactory.addParameter("ismodule", item.getString("ismodule"));
|
|
|
|
|
+ sqlFactory.addParameter("packageqty", item.getString("packageqty"));
|
|
|
|
|
+ sqlFactory.addParameter("iswoodproducts", item.getString("iswoodproducts"));
|
|
|
|
|
+
|
|
|
|
|
+ sqlFactory.addParameter("sa_customschemeid", item.getString("sa_customschemeid"));
|
|
|
|
|
+ sqlFactory.addParameter("financeclasstype", item.getString("financeclasstype"));
|
|
|
|
|
+ sqlFactory.addParameter("stockno", item.getString("stockno"));
|
|
|
|
|
+ sqlFactory.addParameter("volume", item.getBigDecimal("volume"));
|
|
|
|
|
+
|
|
|
|
|
+ sqlFactory.addParameter("iscustomsize", 0);
|
|
|
|
|
+ sqlFactory.addParameter("customprice", item.getBigDecimal("customprice"));
|
|
|
|
|
+ sqlFactory.addParameter("widthschemeid", item.getBigDecimal("widthschemeid"));
|
|
|
|
|
+ sqlFactory.addParameter("lengthschemeid", item.getBigDecimal("lengthschemeid"));
|
|
|
|
|
+ sqlFactory.addParameter("pricingmetod", item.getLong("pricingmetod"));
|
|
|
|
|
+
|
|
|
|
|
+ //德莱宝,工艺定义方案id
|
|
|
|
|
+ sqlFactory.addParameter("cheekschemeid", item.getBigDecimal("cheekschemeid"));
|
|
|
|
|
+ //德莱宝,颜色定义方案id
|
|
|
|
|
+ sqlFactory.addParameter("colorschemeid", item.getBigDecimal("colorschemeid"));
|
|
|
|
|
+ //德莱宝,选项定义方案id
|
|
|
|
|
+ sqlFactory.addParameter("materialschemeid", item.getBigDecimal("materialschemeid"));
|
|
|
|
|
+
|
|
|
|
|
+ sqlFactory.addParameter("saleprice", item.getBigDecimal("saleprice"));
|
|
|
|
|
+ sqlFactory.addParameter("cost", item.getBigDecimal("cost"));
|
|
|
|
|
+ sqlFactory.addParameter("grossprofit", item.getBigDecimal("grossprofit"));
|
|
|
|
|
+ sqlFactory.addParameter("grossprofitmargin", item.getBigDecimal("grossprofitmargin"));
|
|
|
|
|
+ sqlFactory.addParameter("soldbase", item.getBigDecimal("soldbase"));
|
|
|
|
|
+ sqlFactory.addParameter("byname", item.getString("byname"));
|
|
|
|
|
+ //rate,grade,custamount,safeqty,icaddqty,icminqty,iswriteoff,isnegative,ispartorderautocheck,islimitemparts,itemname_print,
|
|
|
|
|
+ //applicablegassource,hygienelicensenum,departmentid,executionstandards,itemclsnum,outplace
|
|
|
|
|
+ sqlFactory.addParameter("rate", item.getBigDecimal("rate"));
|
|
|
|
|
+ sqlFactory.addParameter("grade", item.getString("grade"));
|
|
|
|
|
+ sqlFactory.addParameter("custamount", item.getBigDecimal("custamount"));
|
|
|
|
|
+ sqlFactory.addParameter("safeqty", item.getBigDecimal("safeqty"));
|
|
|
|
|
+ sqlFactory.addParameter("icaddqty", item.getBigDecimal("icaddqty"));
|
|
|
|
|
+ sqlFactory.addParameter("icminqty", item.getBigDecimal("icminqty"));
|
|
|
|
|
+ sqlFactory.addParameter("iswriteoff", item.getBoolean("iswriteoff"));
|
|
|
|
|
+ sqlFactory.addParameter("isnegative", item.getBoolean("isnegative"));
|
|
|
|
|
+ sqlFactory.addParameter("ispartorderautocheck", item.getString("ispartorderautocheck"));
|
|
|
|
|
+ sqlFactory.addParameter("islimitemparts", item.getString("islimitemparts"));
|
|
|
|
|
+ sqlFactory.addParameter("itemname_print", item.getString("itemname_print"));
|
|
|
|
|
+ sqlFactory.addParameter("applicablegassource", item.getString("applicablegassource"));
|
|
|
|
|
+ sqlFactory.addParameter("hygienelicensenum", item.getString("hygienelicensenum"));
|
|
|
|
|
+ sqlFactory.addParameter("departmentid", item.getString("departmentid"));
|
|
|
|
|
+ sqlFactory.addParameter("executionstandards", item.getString("executionstandards"));
|
|
|
|
|
+ sqlFactory.addParameter("itemclsnum", item.getString("itemclsnum"));
|
|
|
|
|
+ sqlFactory.addParameter("outplace", item.getString("outplace"));
|
|
|
|
|
+ sqlFactory.addParameter("repairattribute", item.getString("repairattribute"));
|
|
|
|
|
+ sqlFactory.addParameter("shapesize", item.getString("shapesize"));
|
|
|
|
|
+ sqlFactory.addParameter("topclassnum", item.getString("topclassnum"));
|
|
|
|
|
+
|
|
|
|
|
+ sqlList.add(sqlFactory.getSQL());
|
|
|
|
|
+ // 货品档案扩展属性字段表
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if(!itemextendRows.isEmpty()){
|
|
|
|
|
+ sqlFactory = new SQLFactory(this, "货品档案-扩展新增");
|
|
|
|
|
+ long plm_itemextendid = createTableID("plm_itemextend");
|
|
|
|
|
+ Row itemextendRow = itemextendRows.get(0);
|
|
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
|
|
+ sqlFactory.addParameter("userid", userid);
|
|
|
|
|
+ sqlFactory.addParameter("username", username);
|
|
|
|
|
+ sqlFactory.addParameter("plm_itemextendid", plm_itemextendid);
|
|
|
|
|
+ sqlFactory.addParameter("itemid", newitemid);
|
|
|
|
|
+ //基材(德莱宝中为选项)
|
|
|
|
|
+ sqlFactory.addParameter("material", itemextendRow.getString("material"));
|
|
|
|
|
+ sqlFactory.addParameter("pressure", itemextendRow.getString("pressure"));
|
|
|
|
|
+ sqlFactory.addParameter("caliber", itemextendRow.getString("caliber"));
|
|
|
|
|
+ sqlFactory.addParameter("butterflyplatedrive", itemextendRow.getString("butterflyplatedrive"));
|
|
|
|
|
+ sqlFactory.addParameter("connection", itemextendRow.getString("connection"));
|
|
|
|
|
+ sqlFactory.addParameter("valveplatematerial", itemextendRow.getString("valveplatematerial"));
|
|
|
|
|
+ sqlFactory.addParameter("bodymaterial", itemextendRow.getString("bodymaterial"));
|
|
|
|
|
+ sqlFactory.addParameter("actuatortype", itemextendRow.getString("actuatortype"));
|
|
|
|
|
+ sqlFactory.addParameter("actuatorbrand", itemextendRow.getString("actuatorbrand"));
|
|
|
|
|
+ sqlFactory.addParameter("isbutterfly", itemextendRow.getBoolean("isbutterfly"));
|
|
|
|
|
+ sqlFactory.addParameter("erpitemno", itemextendRow.getString("erpitemno"));
|
|
|
|
|
+ sqlFactory.addParameter("erpitemname", itemextendRow.getString("erpitemname"));
|
|
|
|
|
+ String specalnote = itemextendRow.getString("specalnote");
|
|
|
|
|
+ sqlFactory.addParameter("specalnote", specalnote);
|
|
|
|
|
+ sqlFactory.addParameter("prodline", itemextendRow.getString("prodline"));
|
|
|
|
|
+ sqlFactory.addParameter("device", itemextendRow.getString("device"));
|
|
|
|
|
+
|
|
|
|
|
+ sqlList.add(sqlFactory.getSQL());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(!itemtradefieldRows.isEmpty()){
|
|
|
|
|
+ sqlFactory = new SQLFactory(this, "新增领域");
|
|
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
|
|
+ sqlFactory.addParameter("plm_item_tradefieldid", createTableID("plm_item_tradefield"));
|
|
|
|
|
+ sqlFactory.addParameter("tradefield", itemtradefieldRows.get(0).getString("tradefield"));
|
|
|
|
|
+ sqlFactory.addParameter("userid", userid);
|
|
|
|
|
+ sqlFactory.addParameter("itemid", newitemid);
|
|
|
|
|
+ sqlList.add(sqlFactory.getSQL());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(!itemsaleclassRows.isEmpty()){
|
|
|
|
|
+ for(Row row :itemsaleclassRows){
|
|
|
|
|
+ sqlFactory = new SQLFactory(this, "商品营销类别新增");
|
|
|
|
|
+ sqlFactory.addParameter("sa_itemsaleclassid", createTableID("sa_itemsaleclass"));
|
|
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
|
|
+ sqlFactory.addParameter("itemid", newitemid);
|
|
|
|
|
+ sqlFactory.addParameter("itemno", "复制"+item.getString("itemno"));
|
|
|
|
|
+ sqlFactory.addParameter("classtype", row.getString("classtype"));
|
|
|
|
|
+ sqlFactory.addParameter("itemclassid", row.getLong("itemclassid"));
|
|
|
|
|
+
|
|
|
|
|
+ sqlList.add(sqlFactory.getSQL());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!attachmentLinksRows.isEmpty()){
|
|
|
|
|
+ for(Row row :attachmentLinksRows){
|
|
|
|
|
+ Long linksid = createTableID("sys_attachment_links");
|
|
|
|
|
+ InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_attachment_links");
|
|
|
|
|
+ insertSQL.setValue("linksid", linksid);
|
|
|
|
|
+ insertSQL.setValue("siteid", siteid);
|
|
|
|
|
+ insertSQL.setValue("ownertable", "plm_item");
|
|
|
|
|
+ insertSQL.setValue("ownerid", newitemid);
|
|
|
|
|
+ insertSQL.setValue("attachmentid", row.getLong("attachmentid"));
|
|
|
|
|
+ insertSQL.setValue("usetype", row.getString("usertype"));
|
|
|
|
|
+ insertSQL.setValue("sequence", row.getLong("sequence"));
|
|
|
|
|
+ insertSQL.setValue("createby", username);
|
|
|
|
|
+ insertSQL.setDateValue("createdate");
|
|
|
|
|
+ insertSQL.setValue("changeby", username);
|
|
|
|
|
+ insertSQL.setDateValue("changedate");
|
|
|
|
|
+ sqlList.add(insertSQL.getSQL());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ dbConnect.runSqlUpdate(sqlList);
|
|
|
|
|
+
|
|
|
|
|
+ content.put("itemid", newitemid);
|
|
|
|
|
+ return queryDetail();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@API(title = "货品档案详情", apiversion = R.ID20220923155302.v1.class)
|
|
@API(title = "货品档案详情", apiversion = R.ID20220923155302.v1.class)
|
|
|
public String queryDetail() throws YosException {
|
|
public String queryDetail() throws YosException {
|
|
|
|
|
|