Browse Source

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@1060 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d

administrator 11 years ago
parent
commit
e6fd2abdea
1 changed files with 12 additions and 47 deletions
  1. 12 47
      src/main/java/com/uas/platform/b2b/model/PurchaseNotice.java

+ 12 - 47
src/main/java/com/uas/platform/b2b/model/PurchaseNotice.java

@@ -1,7 +1,6 @@
 package com.uas.platform.b2b.model;
 
 import java.io.Serializable;
-import java.util.Calendar;
 import java.util.Date;
 
 import javax.persistence.CascadeType;
@@ -15,8 +14,6 @@ import javax.persistence.OneToOne;
 import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 
-import com.uas.platform.core.model.Status;
-
 /**
  * 平台里面,以供应商的角度来查看客户送货提醒
  * 
@@ -119,6 +116,12 @@ public class PurchaseNotice implements Serializable {
 	@Column(name = "pn_endstatus")
 	private Short endStatus;
 
+	/**
+	 * 备货状态(1--是、0--否)
+	 */
+	@Column(name = "is_waiting", insertable = false, updatable = false)
+	private Short isWaiting;
+
 	public Long getId() {
 		return id;
 	}
@@ -239,50 +242,12 @@ public class PurchaseNotice implements Serializable {
 		this.orderItemId = orderItemId;
 	}
 
-	/**
-	 * 备货
-	 * 
-	 * @return
-	 */
-	public boolean isWaiting() {
-		Float stock = this.getOrderItem().getProduct().getLtinstock();
-		stock = stock == null ? 0 : stock;
-		if (delivery != null) {
-			Calendar nowCalendar = Calendar.getInstance();
-			nowCalendar.setTime(new Date());
-			int nowYear = nowCalendar.get(Calendar.YEAR);
-			int nowMonth = nowCalendar.get(Calendar.MONTH);
-			int nowDay = nowCalendar.get(Calendar.DAY_OF_MONTH);
-			Calendar calendar = Calendar.getInstance();
-			calendar.setTime(delivery);
-			int year = calendar.get(Calendar.YEAR);
-			int month = calendar.get(Calendar.MONTH);
-			int day = calendar.get(Calendar.DAY_OF_MONTH);
-			if (stock == -1) {
-				if (nowDay > 25)
-					return (year > nowYear && (month + 12 * (year - nowYear) - nowMonth) > 1)
-							|| (year == nowYear && month > nowMonth + 1);
-				else
-					return (year > nowYear)
-							|| (year == nowYear && month > nowMonth);
-			} else if (stock >= 0) {
-				nowCalendar.set(nowYear, nowMonth, (int) (nowDay + stock + 1),
-						0, 0, 0);
-				calendar.set(year, month, day, 0, 0, 0);
-				return nowCalendar.compareTo(calendar) == -1;
-			}
-		}
-		return true;
-	}
-	
-	public String getNeedWaiting() {
-		if(this.status == Status.NOT_REPLY.value()) {
-			if(this.isWaiting())
-				return "需要";
-			else 
-				return "不需要";
-		} else 
-			return "";
+	public Short getIsWaiting() {
+		return isWaiting;
+	}
+
+	public void setIsWaiting(Short isWaiting) {
+		this.isWaiting = isWaiting;
 	}
 
 }