Forráskód Böngészése

平台更新物料传回ERP修改保存

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@9414 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 8 éve
szülő
commit
c8d909f5ab

+ 27 - 30
src/main/java/com/uas/platform/b2b/erp/service/impl/ProdServiceImpl.java

@@ -8,11 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
-import com.uas.platform.b2b.dao.ComponentDao;
 import com.uas.platform.b2b.dao.ProductDao;
 import com.uas.platform.b2b.erp.model.Prod;
 import com.uas.platform.b2b.erp.service.ProdService;
-import com.uas.platform.b2b.model.Component;
 import com.uas.platform.b2b.model.Product;
 import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.core.model.Constant;
@@ -23,42 +21,40 @@ public class ProdServiceImpl implements ProdService {
 	@Autowired
 	private ProductDao productDao;
 
-	@Autowired
-	private ComponentDao componentDao;
-
 	@Override
 	public List<Product> convertProduct(List<Prod> prods) {
 		List<Product> products = new ArrayList<Product>();
 		long enUU = SystemSession.getUser().getEnterprise().getUu();
 		for (Prod prod : prods) {
 			prod.setKind(prod.getPr_detail());
-			if (prod.getPr_orispeccode() == null) {// 如果原厂型号不存在,将型号赋值给原厂型号
+			if (prod.getPr_orispeccode() == null) {// 如果原厂型号不存在,将规格赋值给原厂型号
 				prod.setPr_orispeccode(prod.getPr_spec());
 			}
-			if (prod.getPr_uuid() == null) {
-				if (prod.getPr_code() != null) {
-					List<Component> components = componentDao.findByCode(prod.getPr_orispeccode());
-					if (components.size() == 1) {// 如果查询是标准数据,给个标准赋值
-						prod.setPr_uuid(components.get(0).getUuid());
-						prod.setPbrand(components.get(0).getBrand().getNameCn());
-						prod.setPbranden(components.get(0).getBrand().getNameEn());
-						prod.setKind(components.get(0).getKind().getNameCn());
-						prod.setKinden(components.get(0).getKind().getNameEn());
-					}
-				}
-			} else {
-				Component component = componentDao.findByUuid(prod.getPr_uuid());
-				prod.setPr_uuid(component.getUuid());
-				prod.setPbrand(component.getBrand().getNameCn());
-				prod.setPbranden(component.getBrand().getNameEn());
-				prod.setKind(component.getKind().getNameCn());
-				prod.setKinden(component.getKind().getNameEn());
-			}
-			if (prod.getPr_uuid() != null) {
-				prod.setStandard(Constant.YES);
-			} else {
-				prod.setStandard(Constant.NO);
-			}
+			// if (prod.getPr_uuid() == null) {
+			// if (prod.getPr_code() != null) {
+			// List<Component> components =
+			// componentDao.findByCode(prod.getPr_orispeccode());
+			// if (components.size() == 1) {// 如果查询是标准数据,给个标准赋值
+			// prod.setPr_uuid(components.get(0).getUuid());
+			// prod.setPbrand(components.get(0).getBrand().getNameCn());
+			// prod.setPbranden(components.get(0).getBrand().getNameEn());
+			// prod.setKind(components.get(0).getKind().getNameCn());
+			// prod.setKinden(components.get(0).getKind().getNameEn());
+			// }
+			// }
+			// } else {
+			// Component component = componentDao.findByUuid(prod.getPr_uuid());
+			// prod.setPr_uuid(component.getUuid());
+			// prod.setPbrand(component.getBrand().getNameCn());
+			// prod.setPbranden(component.getBrand().getNameEn());
+			// prod.setKind(component.getKind().getNameCn());
+			// prod.setKinden(component.getKind().getNameEn());
+			// }
+			// if (prod.getPr_uuid() != null) {
+			// prod.setStandard(Constant.YES);
+			// } else {
+			// prod.setStandard(Constant.NO);
+			// }
 			List<Product> prodResult = productDao.findByEnUUAndCode(enUU, prod.getPr_code());
 			if (CollectionUtils.isEmpty(prodResult)) {// 平台上不存在的新上传上来的物料,新增
 				products.add(prod.convert());
@@ -69,6 +65,7 @@ public class ProdServiceImpl implements ProdService {
 				product.setErpDate(new Date());
 				product.setIsPubsale(Constant.YES);
 				product.setIsSale(Constant.YES);
+				product.setSourceApp("ERP");
 				products.add(product);
 			}
 		}