|
@@ -4,8 +4,12 @@ import com.jpsoft.printing.config.OSSConfig;
|
|
|
import com.jpsoft.printing.modules.base.dto.YearSoaDTO;
|
|
|
import com.jpsoft.printing.modules.base.entity.Account;
|
|
|
import com.jpsoft.printing.modules.base.entity.Customer;
|
|
|
+import com.jpsoft.printing.modules.base.entity.Stock;
|
|
|
+import com.jpsoft.printing.modules.base.entity.Work;
|
|
|
import com.jpsoft.printing.modules.base.service.AccountService;
|
|
|
import com.jpsoft.printing.modules.base.service.CustomerService;
|
|
|
+import com.jpsoft.printing.modules.base.service.StockService;
|
|
|
+import com.jpsoft.printing.modules.base.service.WorkService;
|
|
|
import com.jpsoft.printing.modules.common.dto.MessageResult;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -36,6 +41,10 @@ public class ReportController {
|
|
|
@Autowired
|
|
|
private OSSConfig ossConfig;
|
|
|
@Autowired
|
|
|
+ private WorkService workService;
|
|
|
+ @Autowired
|
|
|
+ private StockService stockService;
|
|
|
+ @Autowired
|
|
|
private AccountService accountService;
|
|
|
@Autowired
|
|
|
private CustomerService customerService;
|
|
@@ -407,4 +416,88 @@ public class ReportController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="发货结算表数据")
|
|
|
+ private Map dataFHJSB(String customerId, Date selectDate){
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(selectDate);
|
|
|
+ String dateStart = sdf.format(calendar.getTime());
|
|
|
+
|
|
|
+ calendar.add(Calendar.MONTH, 1);
|
|
|
+ String dateEnd = sdf.format(calendar.getTime());
|
|
|
+
|
|
|
+ Customer customer = customerService.get(customerId);
|
|
|
+
|
|
|
+ List<Map> mapList = new ArrayList<>();
|
|
|
+ List<Work> workList = workService.findList(dateStart, dateEnd, "create_time ASC");
|
|
|
+ for(Work work : workList){
|
|
|
+ Map<String, Object> accMap = new HashMap<>();
|
|
|
+
|
|
|
+ //账目
|
|
|
+ Account account = accountService.getByWorkId(work.getId());
|
|
|
+ if(account != null){
|
|
|
+ accMap.put("actualAmount", account.getActualAmount());//实数金额
|
|
|
+ accMap.put("clothAmount", account.getClothAmount());//坯布金额
|
|
|
+ accMap.put("rollAmount", account.getRollAmount());//力工金额
|
|
|
+ accMap.put("totalAmount", account.getTotalAmount());//总金额
|
|
|
+ }
|
|
|
+
|
|
|
+ //打卷
|
|
|
+ BigDecimal estimateQuantityM = new BigDecimal(0);
|
|
|
+ List<String> lengthList = new ArrayList<>();
|
|
|
+ List<String> shipmentList = new ArrayList<>();
|
|
|
+ List<Stock> stockList = stockService.findList(work.getId());
|
|
|
+ for(Stock stock : stockList){
|
|
|
+ lengthList.add(stock.getLength() + "m");
|
|
|
+ estimateQuantityM = estimateQuantityM.add(stock.getLength());
|
|
|
+ if(stock.getUpdateTime() != null && !shipmentList.contains(sdf.format(stock.getUpdateTime()))) {
|
|
|
+ shipmentList.add(sdf.format(stock.getUpdateTime()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BigDecimal estimateQuantityY = estimateQuantityM.divide(new BigDecimal("0.9144"), 0, RoundingMode.HALF_UP);
|
|
|
+
|
|
|
+ accMap.put("name", work.getName());//品种及规格
|
|
|
+ accMap.put("width", work.getWidth());//幅宽
|
|
|
+ accMap.put("number", work.getNumber());//编号
|
|
|
+ accMap.put("processDate", sdf.format(work.getProcessDate()));//投坯日
|
|
|
+ accMap.put("processVolume", work.getProcessVolume());//投坯数(米)
|
|
|
+ accMap.put("processRemark", work.getProcessRemark());//投坯卷数
|
|
|
+ accMap.put("processNumber", work.getProcessNumber());//投坯备注
|
|
|
+ accMap.put("ratio", work.getRatio());//伸长率
|
|
|
+ accMap.put("colour", work.getColour());//色泽
|
|
|
+ accMap.put("estimateQuantity", work.getEstimateQuantity());//应交成品数(米)
|
|
|
+ accMap.put("estimateRemark", work.getEstimateRemark());//应交成品数备注
|
|
|
+ accMap.put("shipment", String.join(",", shipmentList));//发货日
|
|
|
+ accMap.put("actualRemark", String.join("+", lengthList));//实交成品数-详情
|
|
|
+ accMap.put("estimateQuantityY", estimateQuantityY);//应交成品数(码)
|
|
|
+ accMap.put("estimateQuantityM", estimateQuantityM);//应交成品数(米)
|
|
|
+ accMap.put("unitPrice", work.getUnitPrice());//单价(元/米)
|
|
|
+ accMap.put("clothQuantity", estimateQuantityM.subtract(work.getEstimateQuantity()));//坯布数(米)
|
|
|
+ accMap.put("clothPrice", work.getClothPrice());//坯布单价(元/米)
|
|
|
+ accMap.put("remark", work.getRemark());//备注
|
|
|
+ mapList.add(accMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("name", customer.getCompany());
|
|
|
+ map.put("date", dateStart.substring(0,4) + "年" + dateStart.substring(5,7) + "月");
|
|
|
+ map.put("list", customer.getCompany());
|
|
|
+
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="发货结算表")
|
|
|
+ @RequestMapping(value = "monthFHJSB",method = RequestMethod.POST)
|
|
|
+ public MessageResult monthFHJSB(String customerId, Date selectDate){
|
|
|
+ MessageResult msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map map = dataFHJSB(customerId, selectDate);
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(map);
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|