|
|
@@ -16,7 +16,9 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import restcontroller.R;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
|
|
|
@API(title = "送修单")
|
|
|
public class sendrepair extends Controller {
|
|
|
@@ -834,7 +836,7 @@ public class sendrepair extends Controller {
|
|
|
*/
|
|
|
public ArrayList<String> updatefitemno(boolean istrue, Row sendrepairdetail) throws YosException {
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
- Rows skurows = dbConnect.runSqlQuery("select * from sa_itemsku where sku='" + sendrepairdetail.getString("sku") + "' and status!='报废'");
|
|
|
+ Rows skurows = dbConnect.runSqlQuery("select * from sa_itemsku where siteid='"+siteid+"' and sku='" + sendrepairdetail.getString("sku") + "' and status!='报废'");
|
|
|
if (skurows.isEmpty()) {
|
|
|
throw new YosException("序列号不存在或已作废");
|
|
|
}
|
|
|
@@ -1008,6 +1010,7 @@ public class sendrepair extends Controller {
|
|
|
insertSQL.setValue("createby", username);
|
|
|
insertSQL.setDateValue("createdate");
|
|
|
insertSQL.setDateValue("billdate");
|
|
|
+ insertSQL.setValue("period", getPeriod(getDate()));
|
|
|
insertSQL.setValue("checkby", username);
|
|
|
insertSQL.setDateValue("checkdate");
|
|
|
sqlList.add(insertSQL.getSQL());
|
|
|
@@ -1054,6 +1057,16 @@ public class sendrepair extends Controller {
|
|
|
return sqlList;
|
|
|
}
|
|
|
|
|
|
+ public String getPeriod(Date date) throws YosException {
|
|
|
+ String preioddate = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select CONCAT_WS('-', year, LPAD(month, 2, '0')) period from st_period where begdate<='" + preioddate + "' and enddate>='" + preioddate + "'");
|
|
|
+ if (rows.size() != 1) {
|
|
|
+ throw new YosException("单据日期所属会计期间未生成");
|
|
|
+ } else {
|
|
|
+ return rows.get(0).getString("period");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 正品入库
|
|
|
*/
|