|
|
@@ -11,7 +11,12 @@ import com.uas.ps.product.service.ProductService;
|
|
|
import com.uas.ps.product.sync.WaitSyncHelper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
@@ -34,6 +39,17 @@ public class ProductController {
|
|
|
@Autowired
|
|
|
private WaitSyncHelper waitSyncHelper;
|
|
|
|
|
|
+ /**
|
|
|
+ * 一键开启/关闭 对应的物料采购属性
|
|
|
+ */
|
|
|
+ private static final String PRODUCT_PURCHASE_STATUS = "purc";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 一键开启/关闭 对应的物料销售属性
|
|
|
+ */
|
|
|
+ private static final String PRODUCT_SALE_STATUS = "sale";
|
|
|
+
|
|
|
+
|
|
|
// @Autowired
|
|
|
// private UserDao userDao;
|
|
|
|
|
|
@@ -322,10 +338,17 @@ public class ProductController {
|
|
|
public void switchProductByEnUU(@RequestParam("enUU") Long enUU,
|
|
|
@RequestParam("switchType") String switchType,
|
|
|
@RequestParam("switchStatus") Short switchStatus) {
|
|
|
- Integer size = productService.getCountByEnUU(enUU);
|
|
|
- waitSyncHelper.preWait("B2B", size);
|
|
|
- productService.switchProductByEnuuAndTypeAndStatus(enUU, switchType, switchStatus);
|
|
|
- waitSyncHelper.waitResponse();
|
|
|
+ Integer size = 0;
|
|
|
+ if (switchType.equals(PRODUCT_PURCHASE_STATUS)) {
|
|
|
+ size = productService.getCountByEnUUAndNotIsPurchase(enUU, switchStatus);
|
|
|
+ } else if (switchType.equals(PRODUCT_SALE_STATUS)){
|
|
|
+ size = productService.getCountByEnUUAndNotIsSale(enUU, switchStatus);
|
|
|
+ }
|
|
|
+ if (size > 0) {
|
|
|
+ waitSyncHelper.preWait("B2B", size);
|
|
|
+ productService.switchProductByEnuuAndTypeAndStatus(enUU, switchType, switchStatus);
|
|
|
+ waitSyncHelper.waitResponse();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|