Explorar el Código

MRB

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@576 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
suntg hace 11 años
padre
commit
529e8f2de1

+ 51 - 0
src/main/java/com/uas/platform/b2b/erp/controller/PurchaseQuaMRBController.java

@@ -0,0 +1,51 @@
+package com.uas.platform.b2b.erp.controller;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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 com.uas.platform.b2b.erp.model.PurchaseQuaMRB;
+import com.uas.platform.b2b.erp.service.PurchaseQuaMRBService;
+import com.uas.platform.b2b.service.PurchaseMRBService;
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
+
+/**
+ * 对买家ERP的数据接口<br>
+ * 买家MRB单接口
+ * 
+ * @author suntg
+ * 
+ */
+@Controller
+@RequestMapping("/erp/purchase/MRB")
+public class PurchaseQuaMRBController {
+
+	@Autowired
+	PurchaseMRBService purchaseMRBService;
+	
+	@Autowired
+	PurchaseQuaMRBService purchaseQuaMRBService;
+
+	/**
+	 * 将ERP的采购变更单写到平台
+	 * 
+	 * @param data
+	 * @return
+	 * @throws UnsupportedEncodingException
+	 */
+	@RequestMapping(method = RequestMethod.POST)
+	@ResponseBody
+	public void savePurchases(@RequestParam("data") String data) throws UnsupportedEncodingException {
+		String jsonStr = URLDecoder.decode(data, "UTF-8");
+		List<PurchaseQuaMRB> quaMRBs = FlexJsonUtils.fromJsonArray(jsonStr, PurchaseQuaMRB.class);
+		purchaseMRBService.save(purchaseQuaMRBService.convertMRBs(quaMRBs));
+	}
+
+}

+ 57 - 0
src/main/java/com/uas/platform/b2b/erp/controller/SaleQuaMRBController.java

@@ -0,0 +1,57 @@
+package com.uas.platform.b2b.erp.controller;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+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 com.uas.platform.b2b.erp.model.SaleQuaMRB;
+import com.uas.platform.b2b.erp.service.SaleQuaMRBService;
+import com.uas.platform.b2b.service.PurchaseMRBService;
+
+/**
+ * 对卖家ERP的数据接口<br>
+ * 客户MRB单
+ * @author suntg
+ *
+ */
+@Controller
+@RequestMapping("/erp/sale/MRB")
+public class SaleQuaMRBController {
+
+	@Autowired
+	private PurchaseMRBService purchaseMRBService;
+
+	@Autowired
+	private SaleQuaMRBService saleQuaMRBService;
+
+	/**
+	 * 卖家ERP从平台获取未下载的客户不良品入库单
+	 * 
+	 * @return
+	 */
+	@RequestMapping(method = RequestMethod.GET)
+	@ResponseBody
+	public List<SaleQuaMRB> getSaleQuaMRBs() {
+		return saleQuaMRBService.convertPurchaseMRBs(purchaseMRBService.findNotUpload());
+	}
+
+	/**
+	 * 平台的客户不良品入库单传到供应商ERP之后,修改平台里面的客户不良品入库单的上传状态
+	 * 
+	 * @return
+	 * @throws UnsupportedEncodingException
+	 */
+	@RequestMapping(method = RequestMethod.POST)
+	@ResponseBody
+	public void onSaleQuaMRBDownSuccess(@RequestParam("data") String data) throws UnsupportedEncodingException {
+		purchaseMRBService.onUploadSuccess(URLDecoder.decode(data, "UTF-8").split(","));
+	}
+
+}