|
|
@@ -4,7 +4,11 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.util.List;
|
|
|
|
|
|
-import com.uas.platform.b2b.service.PurchaseApBillService;
|
|
|
+import com.uas.platform.b2b.model.MakeAccept;
|
|
|
+import com.uas.platform.b2b.model.MakeReturn;
|
|
|
+import com.uas.platform.b2b.model.PurchaseAccept;
|
|
|
+import com.uas.platform.b2b.model.PurchaseReturn;
|
|
|
+import com.uas.platform.b2b.service.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
@@ -16,7 +20,6 @@ import com.uas.platform.b2b.erp.model.ProdInOutRefreshPrice;
|
|
|
import com.uas.platform.b2b.erp.model.PurchaseProdInOut;
|
|
|
import com.uas.platform.b2b.erp.service.PurchaseProdInOutService;
|
|
|
import com.uas.platform.b2b.erp.support.ErpBufferedLogger;
|
|
|
-import com.uas.platform.b2b.service.PurchaseAcceptService;
|
|
|
import com.uas.platform.core.logging.BufferedLoggerManager;
|
|
|
import com.uas.platform.core.util.serializer.FlexJsonUtils;
|
|
|
|
|
|
@@ -40,6 +43,15 @@ public class PurchaseProdInOutController {
|
|
|
@Autowired
|
|
|
private PurchaseApBillService purchaseApBillService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MakeAcceptService makeAcceptService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MakeReturnService makeReturnService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PurchaseReturnService returnService;
|
|
|
+
|
|
|
private final static ErpBufferedLogger logger = BufferedLoggerManager.getLogger(ErpBufferedLogger.class);
|
|
|
|
|
|
/**
|
|
|
@@ -89,5 +101,61 @@ public class PurchaseProdInOutController {
|
|
|
purchaseAcceptService.save(purchaseProdInOutService.convertPirceForProdIn(prodInOuts));
|
|
|
// 更新关联的应付发票的价格
|
|
|
purchaseApBillService.refreshPrice(prodInOuts);
|
|
|
+ logger.log("批量更新采购验收单单价", "上传批量更新采购验收单单价", prodInOuts.size());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量更新采购验退单单价
|
|
|
+ *
|
|
|
+ * @param data
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/refreshPrice/purc/return", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void refreshPriceForPurcReturn(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
+ List<ProdInOutRefreshPrice> prodInOuts = FlexJsonUtils.fromJsonArray(jsonStr, ProdInOutRefreshPrice.class);
|
|
|
+ // 更新采购验退单的价格
|
|
|
+ returnService.save(returnService.convertPirceForProdIn(prodInOuts));
|
|
|
+ // 更新关联的应付发票的价格
|
|
|
+ purchaseApBillService.refreshPrice(prodInOuts);
|
|
|
+ logger.log("批量更新采购验退单单价", "上传批量更新采购验退单单价", prodInOuts.size());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量更新委外验收单单价
|
|
|
+ *
|
|
|
+ * @param data
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/refreshPrice/make/accept", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void refreshPriceForMakeAccept(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
+ List<ProdInOutRefreshPrice> prodInOuts = FlexJsonUtils.fromJsonArray(jsonStr, ProdInOutRefreshPrice.class);
|
|
|
+ // 更新委外验收单的价格
|
|
|
+ makeAcceptService.save(makeAcceptService.convertPirceForProdIn(prodInOuts));
|
|
|
+ // 更新关联的应付发票的价格
|
|
|
+ purchaseApBillService.refreshPrice(prodInOuts);
|
|
|
+ logger.log("批量更新委外验收单单价", "上传批量更新委外验收单单价", prodInOuts.size());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量更新委外验退单单价
|
|
|
+ *
|
|
|
+ * @param data
|
|
|
+ * @throws UnsupportedEncodingException
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/refreshPrice/make/return", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public void refreshPriceForMakeReturn(@RequestParam("data") String data) throws UnsupportedEncodingException {
|
|
|
+ String jsonStr = URLDecoder.decode(data, "UTF-8");
|
|
|
+ List<ProdInOutRefreshPrice> prodInOuts = FlexJsonUtils.fromJsonArray(jsonStr, ProdInOutRefreshPrice.class);
|
|
|
+ // 更新委外验退单的价格
|
|
|
+ makeReturnService.save(makeReturnService.convertPirceForProdIn(prodInOuts));
|
|
|
+ // 更新关联的应付发票的价格
|
|
|
+ purchaseApBillService.refreshPrice(prodInOuts);
|
|
|
+ logger.log("批量更新委外验退单单价", "上传批量更新委外验退单单价", prodInOuts.size());
|
|
|
}
|
|
|
}
|