|
@@ -19,6 +19,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|
|
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.GsonBuilder;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
@@ -1035,6 +1036,167 @@ public class SyPackingListFabricController {
|
|
|
@Autowired
|
|
|
private SyOrderDataMapper syOrderDataMapper;
|
|
|
|
|
|
+ @AutoLog(value = "关闭-不在推送")
|
|
|
+ @ApiOperation(value="关闭-不在推送", notes="关闭-不在推送")
|
|
|
+ @GetMapping(value = "/cancelPush")
|
|
|
+ public Result cancelPush(String id) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(oConvertUtils.isEmpty(id)){
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.setMessage("请至少选中一条数据");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ SyPackingListFabric syPackingListFabric=syPackingListFabricService.getById(id);
|
|
|
+ if(syPackingListFabric==null){
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.setMessage("数据库未找到数据");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ syPackingListFabric.setPushState("4");
|
|
|
+ syPackingListFabricService.updateById(syPackingListFabric);
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setMessage("修改成功");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @AutoLog(value = "装箱单面辅料批量推送u8")
|
|
|
+ @ApiOperation(value="装箱单面辅料批量推送u8", notes="装箱单面辅料批量推送u8")
|
|
|
+ @GetMapping(value = "/pushBatch2")
|
|
|
+ public Result pushBatch2(String[] ids) {
|
|
|
+ Result result=new Result();
|
|
|
+ if(oConvertUtils.isEmpty(ids)){
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.setMessage("请至少选中一条数据");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ UpdateWrapper updateWrapper=new UpdateWrapper();
|
|
|
+ updateWrapper.set("push_State","3");
|
|
|
+ updateWrapper.set("recording_Status",1);//推送中
|
|
|
+ updateWrapper.in("id",ids);
|
|
|
+ syPackingListFabricService.update(updateWrapper);
|
|
|
+ String message2="";
|
|
|
+ for (int i=0; i<ids.length;i++){
|
|
|
+ try {
|
|
|
+ String id=ids[i];
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ SyPackingListFabric main=syPackingListFabricService.getById(id);
|
|
|
+ if(main.getIsReference()==0){
|
|
|
+ message2="请先做托书再推送";
|
|
|
+ }
|
|
|
+ Map<String,Object> mapdate=syPackingListTailoringService.getSyShippingOrder(id);
|
|
|
+ if(mapdate!=null){
|
|
|
+ if(!mapdate.containsKey("e4")||mapdate.get("e4").equals("0")){
|
|
|
+ message2="请先提交托书再推送";
|
|
|
+ }
|
|
|
+ if(mapdate.containsKey("e1")&&mapdate.get("e1")!=null){
|
|
|
+ main.setTheFinalShippingDate(mapdate.get("e1").toString());
|
|
|
+ }else{
|
|
|
+ message2="请先维护最终船期再推送";
|
|
|
+ }
|
|
|
+ if(mapdate.containsKey("e2")&&mapdate.get("e2")!=null){
|
|
|
+ main.setTheFinalShippingDate2(mapdate.get("e2").toString());
|
|
|
+ }
|
|
|
+ if(mapdate.containsKey("e3")&&mapdate.get("e3")!=null){
|
|
|
+ main.setLatestDateOfShipment2(mapdate.get("e3").toString());
|
|
|
+ }else{
|
|
|
+ message2="请先维护装运期限再推送";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*if(main.getRecordingStatus()!=null&&main.getRecordingStatus()==1){
|
|
|
+ message2="数据在推送中,请不要重复点击";
|
|
|
+ }else{
|
|
|
+ main.setRecordingStatus(1);
|
|
|
+ syPackingListFabricService.updateById(main);//修改成衣
|
|
|
+ }*/
|
|
|
+ List<SyPackingListFabricItem> items=syPackingListFabricItemService.selectByMainId3(id);
|
|
|
+ String message="";//获取报错消息
|
|
|
+ String account="";//当前账套
|
|
|
+ if(items!=null){
|
|
|
+
|
|
|
+ //SyOrderData syOrderData=syOrderDataMapper.selectById(items.get(0).getSyOrderDataId());//最终客户
|
|
|
+ SyOrderData syOrderData=syOrderDataMapper.selectById(items.get(0).getSyOrderDataId());//最终客户
|
|
|
+ if(syOrderData!=null){
|
|
|
+ main.setEndCustomer(syOrderData.getEndCustomer());
|
|
|
+ System.out.println("最终客户\t"+syOrderData.getEndCustomer());
|
|
|
+ }
|
|
|
+ if(syOrderData.getFlag()==1){
|
|
|
+ message2="手工匹配订单不能推送";
|
|
|
+ }
|
|
|
+ if(message2.length()>1){
|
|
|
+ main.setRecordingError(message2);//报错原因
|
|
|
+ main.setPushState("2");//推送失败
|
|
|
+ main.setRecordingStatus(0);//改成未推送
|
|
|
+ syPackingListFabricService.updateById(main);
|
|
|
+ continue;//本次不循环
|
|
|
+ }
|
|
|
+ SyOrderDataItem syOrderDataItem=syOrderDataItemMapper.selectById(items.get(0).getSyOrderDataItemId());//供应商全称
|
|
|
+ if(syOrderDataItem!=null){
|
|
|
+ main.setSupplierCode(syOrderDataItem.getSupplierCode());
|
|
|
+ System.out.println("客户编码\t"+syOrderDataItem.getSupplierCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ main.setSyPackingListFabricItem(items);
|
|
|
+ map.put("account",items.get(0).getOmpoAccount());//委外采购账套号
|
|
|
+ map.put("account1",items.get(0).getOmpoAccount());//委外采购账套号
|
|
|
+ map.put("ompoId",items.get(0).getOmpoId());//采购委外主表id
|
|
|
+ map.put("mpOrder",items.get(0).getPurOrSubOrder());//采购委外订单号
|
|
|
+ map.put("customerCode","one");//客户编码
|
|
|
+ map.put("CVENCODE","one");//供应商编码
|
|
|
+ map.put("orderNumber","one");//销售订单号
|
|
|
+ map.put("poid","one");//销售订单id
|
|
|
+ for (int x=0;x<3;x++){//最多循环3次
|
|
|
+ try {
|
|
|
+ if (map.get("account").equals("103")){
|
|
|
+ account="103";
|
|
|
+ message+=syPackingListFabricService.three(main,map)+";";
|
|
|
+ }else if(map.get("account").equals("102")){
|
|
|
+ account="102";
|
|
|
+ message+=syPackingListFabricService.two(main,map)+";";
|
|
|
+ }else if(map.get("account").equals("101")){
|
|
|
+ account="101";
|
|
|
+ message+=syPackingListFabricService.one(main,map)+";";
|
|
|
+ }else{
|
|
|
+ // 业务员,克重,包装方式,处理方式,是否手册纱,手册纱占比,尺码
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ message+=e.getMessage();
|
|
|
+ if(map.get("account").equals(account)){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //if(message!=null&&message.length()>0&&(message.indexOf("接口")>-1||message.indexOf("账套")>-1)){
|
|
|
+ if(message!=null&&message.length()>0&&message.indexOf("接口")>-1){
|
|
|
+ main.setPushState("2");//推送失败!
|
|
|
+ result.setSuccess(false);
|
|
|
+ main.setRecordingError(message);
|
|
|
+ result.setMessage(message);
|
|
|
+ }else if(message.indexOf("成功")>-1) {
|
|
|
+ main.setPushState("1");//推送成功!
|
|
|
+ result.setSuccess(true);
|
|
|
+ main.setRecordingError(null);
|
|
|
+ result.setMessage(message);
|
|
|
+ }else{
|
|
|
+ main.setPushState("2");//推送失败!
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.setMessage(message);
|
|
|
+ main.setRecordingError(message);
|
|
|
+ }
|
|
|
+ result.setResult(main);
|
|
|
+ main.setRecordingStatus(2);
|
|
|
+ syPackingListFabricService.updateById(main);//修改成衣
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.error500("操作失败:"+e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
@AutoLog(value = "装箱单面辅料推送u8")
|
|
|
@ApiOperation(value="装箱单面辅料推送u8", notes="装箱单面辅料推送u8")
|
|
|
@GetMapping(value = "/pushBatch")
|