Browse Source

更改采购预测传输实现

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@620 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
suntg 11 years ago
parent
commit
415f868e2a

+ 23 - 81
src/main/java/com/uas/platform/b2b/erp/model/PurchaseForecast.java

@@ -11,27 +11,18 @@ import com.uas.platform.b2b.model.PurchaseForecastAll;
 import com.uas.platform.b2b.model.PurchaseForecastAllItem;
 import com.uas.platform.b2b.model.User;
 import com.uas.platform.b2b.support.SystemSession;
-import com.uas.platform.core.model.Status;
-import com.uas.platform.core.util.encry.Md5Utils;
-
 
 public class PurchaseForecast {
 	private Long pf_id;
 	private String pf_code;
 	private Date pf_date;	
-	private Long pf_kind;
+	private String pf_kind;
 	private String pf_recorder;
-	private String pf_purpose;
+	private String pf_purpose;//用途
 	private Long em_uu;
-	private String em_name;
-	private String em_sex;
-	private String em_mobile;
-	private String em_email;
-	/*private Long ve_uu;
-	private Long ve_contactuu;
-	private String ve_contact;*/
-	
 	private List<PurchaseForecastDetail> purchaseForecastDetails;
+	
+	
 	public Long getPf_id() {
 		return pf_id;
 	}
@@ -50,10 +41,10 @@ public class PurchaseForecast {
 	public void setPf_date(Date pf_date) {
 		this.pf_date = pf_date;
 	}
-	public Long getPf_kind() {
+	public String getPf_kind() {
 		return pf_kind;
 	}
-	public void setPf_kind(Long pf_kind) {
+	public void setPf_kind(String pf_kind) {
 		this.pf_kind = pf_kind;
 	}
 	public String getPf_recorder() {
@@ -74,90 +65,41 @@ public class PurchaseForecast {
 	public void setEm_uu(Long em_uu) {
 		this.em_uu = em_uu;
 	}
-	public String getEm_name() {
-		return em_name;
-	}
-	public void setEm_name(String em_name) {
-		this.em_name = em_name;
-	}
-	public String getEm_sex() {
-		return em_sex;
-	}
-	public void setEm_sex(String em_sex) {
-		this.em_sex = em_sex;
-	}
-	public String getEm_mobile() {
-		return em_mobile;
-	}
-	public void setEm_mobile(String em_mobile) {
-		this.em_mobile = em_mobile;
-	}
-	public String getEm_email() {
-		return em_email;
-	}
-	public void setEm_email(String em_email) {
-		this.em_email = em_email;
-	}
-	/*public Long getVe_uu() {
-		return ve_uu;
-	}
-	public void setVe_uu(Long ve_uu) {
-		this.ve_uu = ve_uu;
-	}
-	public Long getVe_contactuu() {
-		return ve_contactuu;
-	}
-	public void setVe_contactuu(Long ve_contactuu) {
-		this.ve_contactuu = ve_contactuu;
-	}
-	public String getVe_contact() {
-		return ve_contact;
-	}
-	public void setVe_contact(String ve_contact) {
-		this.ve_contact = ve_contact;
-	}
 	public List<PurchaseForecastDetail> getPurchaseForecastDetails() {
 		return purchaseForecastDetails;
-	}*/
+	}
 	public void setPurchaseForecastDetails(
 			List<PurchaseForecastDetail> purchaseForecastDetails) {
 		this.purchaseForecastDetails = purchaseForecastDetails;
 	}
-	
+
 	/**
 	 * 转为平台的采购订单
 	 * 
 	 * @return
 	 */
 	public PurchaseForecastAll convert() {
-		PurchaseForecastAll order = new PurchaseForecastAll();
-		order.setCode(this.pf_code);		
-		order.setDate(this.pf_date);
-		order.setEnUU(SystemSession.getUser().getEnterprise().getUu());
-		order.setEnterprise(SystemSession.getUser().getEnterprise());
+		PurchaseForecastAll forecast = new PurchaseForecastAll();
+		forecast.setCode(this.pf_code);		
+		forecast.setDate(this.pf_date);
+		forecast.setEnUU(SystemSession.getUser().getEnterprise().getUu());
+		forecast.setEnterprise(SystemSession.getUser().getEnterprise());
 		User user = new User();
 		user.setUserUU(this.em_uu);
-		user.setUserTel(this.em_mobile);
-		user.setUserSex(("女".equals(this.em_sex) || "F".equals(this.em_sex)) ? "F" : "M");
-		user.setUserPwd(Md5Utils.encode("111111", this.em_uu));
-		user.setUserName(this.em_name);
-		user.setUserEmail(this.em_email);
-		order.setUser(user);
-		if (this.em_uu != null) {//ERP单据中采购员存在UU号
-			order.setUserUU(this.em_uu);
-		}		
-				
-		order.setRecorder(this.pf_recorder);		
-		order.setSendStatus((short) Status.NOT_UPLOAD.value());		
-		/*order.setVendUU(this.ve_uu);//设为单据中供应商UU
-		order.setVendUserUU(this.ve_contactuu);//设为ERP中单据供应商联系人UU		
-*/		if (!CollectionUtils.isEmpty(this.purchaseForecastDetails)) {
+		forecast.setUser(user);
+		if (this.em_uu != null) {//ERP采购预测中采购员存在UU号
+			forecast.setUserUU(this.em_uu);
+		}
+		forecast.setRecorder(this.pf_recorder);
+		forecast.setPurpose(this.pf_purpose);
+		forecast.setKind(this.pf_kind);
+		if (!CollectionUtils.isEmpty(this.purchaseForecastDetails)) {
 			Set<PurchaseForecastAllItem> items = new HashSet<PurchaseForecastAllItem>();
 			for (PurchaseForecastDetail detail : this.purchaseForecastDetails) {
 				items.add(detail.convert());
 			}
-			order.setForecastItems(items);
+			forecast.setForecastItems(items);
 		}
-		return order;
+		return forecast;
 	}
 }

+ 13 - 25
src/main/java/com/uas/platform/b2b/erp/model/PurchaseForecastDetail.java

@@ -5,34 +5,27 @@ import java.util.Date;
 import com.uas.platform.b2b.model.Product;
 import com.uas.platform.b2b.model.PurchaseForecastAllItem;
 import com.uas.platform.b2b.support.SystemSession;
+import com.uas.platform.core.model.Status;
 
 public class PurchaseForecastDetail {
-	private Long b2b_id_id;
-	private short pfd_id;
-	private short pfd_detno;
+	private Long pfd_id;
+	private Short pfd_detno;
 	private String pfd_prodcode;
-	private Double pfd_qty;	
+	private Double pfd_qty;
 	private String pfd_remark;
 	private Date pfd_delivery;
 	private Long ve_uu;
 	private Long ve_contactuu;
-	private String ve_contact;
-	public Long getB2b_id_id() {
-		return b2b_id_id;
-	}
-	public void setB2b_id_id(Long b2b_id_id) {
-		this.b2b_id_id = b2b_id_id;
-	}
-	public short getPfd_id() {
+	public Long getPfd_id() {
 		return pfd_id;
 	}
-	public void setPfd_id(short pfd_id) {
+	public void setPfd_id(Long pfd_id) {
 		this.pfd_id = pfd_id;
 	}
-	public short getPfd_detno() {
+	public Short getPfd_detno() {
 		return pfd_detno;
 	}
-	public void setPfd_detno(short pfd_detno) {
+	public void setPfd_detno(Short pfd_detno) {
 		this.pfd_detno = pfd_detno;
 	}
 	public String getPfd_prodcode() {
@@ -59,8 +52,6 @@ public class PurchaseForecastDetail {
 	public void setPfd_delivery(Date pfd_delivery) {
 		this.pfd_delivery = pfd_delivery;
 	}
-	
-	
 	public Long getVe_uu() {
 		return ve_uu;
 	}
@@ -73,14 +64,9 @@ public class PurchaseForecastDetail {
 	public void setVe_contactuu(Long ve_contactuu) {
 		this.ve_contactuu = ve_contactuu;
 	}
-	public String getVe_contact() {
-		return ve_contact;
-	}
-	public void setVe_contact(String ve_contact) {
-		this.ve_contact = ve_contact;
-	}
+
 	/**
-	 * 转为平台的采购单明细
+	 * 转为平台的采购预测单明细
 	 * 
 	 * @return
 	 */
@@ -90,11 +76,13 @@ public class PurchaseForecastDetail {
 		item.setNumber(this.pfd_detno);		
 		item.setQty(this.pfd_qty);
 		item.setVendUU(this.ve_uu);
-		item.setVendUserUU(this.ve_contactuu);
+		item.setVendUserUU(this.ve_contactuu);//买方ERP中供应商资料中的供应商联系人
+		item.setRemark(pfd_remark);
 		Product product = new Product();
 		product.setCode(this.pfd_prodcode);
 		product.setEnUU(SystemSession.getUser().getEnterprise().getUu());
 		item.setProduct(product);
+		item.setSendStatus((short) Status.NOT_UPLOAD.value());
 		return item;
 	}
 }

+ 59 - 43
src/main/java/com/uas/platform/b2b/erp/model/SaleForecastDown.java

@@ -4,107 +4,123 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
-import org.springframework.util.CollectionUtils;
-
-import com.uas.platform.b2b.model.PurchaseForecastAll;
 import com.uas.platform.b2b.model.PurchaseForecastAllItem;
 
 public class SaleForecastDown {
-	private long b2b_pf_id;
+	private Long b2b_pf_id;
 	private String pf_code;
 	private String pf_kind;
-	private long pf_customeruu;// 客户UU
-	private String pf_contact;// 客户联系人
-	private Long pf_contactuu;// 客户联系人UU
-	private String pf_custmobile;// 客户联系人手机号
-	private long pf_useruu;// 企业业务员UU
-	private Date pf_date;	
-	private String pf_purpose;
+	private Long pf_customeruu;// 客户UU
+	private String pf_customername;//客户名称
+	private String pf_contact;// 客户联系人(采购员)
+	private Long pf_contactuu;// 客户联系人UU(采购员)
+	private String pf_contactmobile;//客户联系人手机号
+	private Date pf_date;//单据录入日期
+	private String pf_purpose;//用途
 	private List<SaleForecastDownDet> saleForecastDownDets;
-	public SaleForecastDown(PurchaseForecastAll order) {
-		// TODO Auto-generated constructor stub
-		this.b2b_pf_id = order.getId();
-		this.pf_code = order.getCode();
-		this.pf_customeruu = order.getEnUU();
-		this.pf_contactuu = order.getUserUU();//存在单据采购员UU为单据采购员UU,否则为系统在平台新增的客户企业的一个用户
-		this.pf_contact = order.getUser().getUserName();		
-		this.pf_useruu = order.getVendUserUU();//单据上的供应商联系人 || 平台上供应商资料信息中的联系人		
-		this.pf_date = order.getDate();
-		this.pf_purpose = order.getPurpose();		
-		if (!CollectionUtils.isEmpty(order.getForecastItems())) {
-			List<SaleForecastDownDet> details = new ArrayList<SaleForecastDownDet>();
-			for (PurchaseForecastAllItem item : order.getForecastItems()) {
-				details.add(new SaleForecastDownDet(item));
-			}
-			this.saleForecastDownDets = details;
-		}
-	}
-	public long getB2b_pf_id() {
+	
+	public Long getB2b_pf_id() {
 		return b2b_pf_id;
 	}
-	public void setB2b_pf_id(long b2b_pf_id) {
+
+	public void setB2b_pf_id(Long b2b_pf_id) {
 		this.b2b_pf_id = b2b_pf_id;
 	}
+
 	public String getPf_code() {
 		return pf_code;
 	}
+
 	public void setPf_code(String pf_code) {
 		this.pf_code = pf_code;
 	}
+
 	public String getPf_kind() {
 		return pf_kind;
 	}
+
 	public void setPf_kind(String pf_kind) {
 		this.pf_kind = pf_kind;
 	}
-	public long getPf_customeruu() {
+
+	public Long getPf_customeruu() {
 		return pf_customeruu;
 	}
-	public void setPf_customeruu(long pf_customeruu) {
+
+	public void setPf_customeruu(Long pf_customeruu) {
 		this.pf_customeruu = pf_customeruu;
 	}
+
+	public String getPf_customername() {
+		return pf_customername;
+	}
+
+	public void setPf_customername(String pf_customername) {
+		this.pf_customername = pf_customername;
+	}
+
 	public String getPf_contact() {
 		return pf_contact;
 	}
+
 	public void setPf_contact(String pf_contact) {
 		this.pf_contact = pf_contact;
 	}
+
 	public Long getPf_contactuu() {
 		return pf_contactuu;
 	}
+
 	public void setPf_contactuu(Long pf_contactuu) {
 		this.pf_contactuu = pf_contactuu;
 	}
-	public String getPf_custmobile() {
-		return pf_custmobile;
-	}
-	public void setPf_custmobile(String pf_custmobile) {
-		this.pf_custmobile = pf_custmobile;
-	}
-	public long getPf_useruu() {
-		return pf_useruu;
+
+	public String getPf_contactmobile() {
+		return pf_contactmobile;
 	}
-	public void setPf_useruu(long pf_useruu) {
-		this.pf_useruu = pf_useruu;
+
+	public void setPf_contactmobile(String pf_contactmobile) {
+		this.pf_contactmobile = pf_contactmobile;
 	}
+
 	public Date getPf_date() {
 		return pf_date;
 	}
+
 	public void setPf_date(Date pf_date) {
 		this.pf_date = pf_date;
 	}
+
 	public String getPf_purpose() {
 		return pf_purpose;
 	}
+
 	public void setPf_purpose(String pf_purpose) {
 		this.pf_purpose = pf_purpose;
 	}
+
 	public List<SaleForecastDownDet> getSaleForecastDownDets() {
 		return saleForecastDownDets;
 	}
+
 	public void setSaleForecastDownDets(
 			List<SaleForecastDownDet> saleForecastDownDets) {
 		this.saleForecastDownDets = saleForecastDownDets;
 	}
+
+	public SaleForecastDown(PurchaseForecastAllItem item) {
+		this.b2b_pf_id = item.getOrder().getId();
+		this.pf_code = item.getOrder().getCode();
+		this.pf_customeruu = item.getOrder().getEnUU();
+		this.pf_contactuu = item.getOrder().getUserUU();//存在单据采购员UU为单据采购员UU,否则为系统在平台新增的客户企业的一个用户
+		this.pf_contact = item.getOrder().getUser().getUserName();
+		this.pf_contactmobile = item.getOrder().getUser().getUserTel();
+		this.pf_date = item.getOrder().getDate();
+		this.pf_purpose = item.getOrder().getPurpose();
+		this.pf_kind = item.getOrder().getKind();
+		List<SaleForecastDownDet> details = new ArrayList<SaleForecastDownDet>();
+		details.add(new SaleForecastDownDet(item));
+		this.saleForecastDownDets = details;
+	}
 	
 }

+ 50 - 22
src/main/java/com/uas/platform/b2b/erp/model/SaleForecastDownDet.java

@@ -5,79 +5,107 @@ import java.util.Date;
 import com.uas.platform.b2b.model.PurchaseForecastAllItem;
 
 public class SaleForecastDownDet {
-	private long b2b_pfd_id;
-	private String pfd_code;
-	private int pfd_detno;
+	private Long b2b_id;
+	private Short pfd_detno;
 	private String pfd_custprodcode;
 	private String pfd_custproddetail;
 	private String pfd_custprodspec;
 	private String pfd_custprodunit;
-	private Date pfd_delivery;	
+	private Date pfd_delivery;
 	private Double pfd_qty;
+	private String pfd_remark;
+	private Long pfd_useruu;//卖方业务员uu号
 	
-	public long getB2b_pfd_id() {
-		return b2b_pfd_id;
-	}
-	public void setB2b_pfd_id(long b2b_pfd_id) {
-		this.b2b_pfd_id = b2b_pfd_id;
-	}
-	public String getPfd_code() {
-		return pfd_code;
-	}
-	public void setPfd_code(String pfd_code) {
-		this.pfd_code = pfd_code;
-	}
-	public int getPfd_detno() {
+	public Short getPfd_detno() {
 		return pfd_detno;
 	}
-	public void setPfd_detno(int pfd_detno) {
+
+	public void setPfd_detno(Short pfd_detno) {
 		this.pfd_detno = pfd_detno;
 	}
+
 	public String getPfd_custprodcode() {
 		return pfd_custprodcode;
 	}
+
 	public void setPfd_custprodcode(String pfd_custprodcode) {
 		this.pfd_custprodcode = pfd_custprodcode;
 	}
+
 	public String getPfd_custproddetail() {
 		return pfd_custproddetail;
 	}
+
 	public void setPfd_custproddetail(String pfd_custproddetail) {
 		this.pfd_custproddetail = pfd_custproddetail;
 	}
+
 	public String getPfd_custprodspec() {
 		return pfd_custprodspec;
 	}
+
 	public void setPfd_custprodspec(String pfd_custprodspec) {
 		this.pfd_custprodspec = pfd_custprodspec;
 	}
+
 	public String getPfd_custprodunit() {
 		return pfd_custprodunit;
 	}
+
 	public void setPfd_custprodunit(String pfd_custprodunit) {
 		this.pfd_custprodunit = pfd_custprodunit;
 	}
+
 	public Date getPfd_delivery() {
 		return pfd_delivery;
 	}
+
 	public void setPfd_delivery(Date pfd_delivery) {
 		this.pfd_delivery = pfd_delivery;
 	}
+
 	public Double getPfd_qty() {
 		return pfd_qty;
 	}
+
 	public void setPfd_qty(Double pfd_qty) {
 		this.pfd_qty = pfd_qty;
 	}
+
+	public String getPfd_remark() {
+		return pfd_remark;
+	}
+
+	public void setPfd_remark(String pfd_remark) {
+		this.pfd_remark = pfd_remark;
+	}
+
+	public Long getPfd_useruu() {
+		return pfd_useruu;
+	}
+
+	public void setPfd_useruu(Long pfd_useruu) {
+		this.pfd_useruu = pfd_useruu;
+	}
+
+	public Long getB2b_id() {
+		return b2b_id;
+	}
+
+	public void setB2b_id(Long b2b_id) {
+		this.b2b_id = b2b_id;
+	}
+
 	public SaleForecastDownDet(PurchaseForecastAllItem item) {
-		// TODO Auto-generated constructor stub
-		this.b2b_pfd_id = item.getId();		
 		this.pfd_custprodcode = item.getProduct().getCode();
 		this.pfd_custproddetail = item.getProduct().getTitle();
 		this.pfd_custprodspec = item.getProduct().getSpec();
 		this.pfd_custprodunit = item.getProduct().getUnit();
-		this.pfd_detno = item.getNumber();		
+		this.pfd_detno = item.getNumber();
 		this.pfd_qty = item.getQty();
-		this.pfd_delivery = item.getDelivery();		
+		this.pfd_delivery = item.getDelivery();	
+		this.pfd_remark = item.getRemark();
+		this.pfd_useruu = item.getVendUserUU();
+		this.b2b_id = item.getId();
 	}
 }