贸易上传

product
17602169347 2 years ago
parent dd0fed2057
commit 4570d7bbc5

@ -1,20 +1,41 @@
package jnpf.tradeupload.controller;
import ai.djl.ModelException;
import ai.djl.translate.TranslateException;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jnpf.base.ActionResult;
import jnpf.base.NoDataSourceBind;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.UserInfo;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.constant.MsgCode;
import jnpf.contractfile.entity.ContractFileEntity;
import jnpf.contractfile.service.ContractFileService;
import jnpf.customer.entity.CustomerEntity;
import jnpf.customer.service.CustomerService;
import jnpf.exception.DataException;
import jnpf.model.UploaderVO;
import jnpf.ocr_sdk.controller.BaiduOcrController;
import jnpf.permission.entity.UserEntity;
import jnpf.utils.YozoUtils;
import jnpf.vehicle.entity.VehicleEntity;
import jnpf.vehicle.service.VehicleService;
import org.apache.poi.ss.formula.functions.T;
import org.bytedeco.opencv.presets.opencv_core;
import org.springframework.http.MediaType;
import org.springframework.transaction.annotation.Transactional;
import jnpf.base.entity.ProvinceEntity;
import jnpf.tradeupload.model.tradeupload.*;
@ -41,10 +62,15 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import jnpf.util.GeneraterSwapUtil;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import jnpf.util.file.UploadUtil;
import jnpf.util.enums.FileTypeEnum;
import jnpf.ocr_sdk.baiduUtils.VatInvoice;
/**
*
@ -72,7 +98,284 @@ public class TradeuploadController {
@Autowired
private TradeuploadService tradeuploadService;
@Autowired
private BaiduOcrController baiduOcrController;
@Autowired
private CustomerService customerService;
@Autowired
private ContractFileService contractFileService;
@Autowired
private VehicleService vehicleService;
@Autowired
private YozoUtils yozoUtils;
/**
* /
*
* @return
*/
@NoDataSourceBind()
@ApiOperation("上传文件/图片")
@PostMapping(value = "/UploaderPondList/{type}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ActionResult uploader(@RequestPart("file") MultipartFile file, @PathVariable("type") String type) throws IOException {
String fileType = UpUtil.getFileType(file);
//验证类型
if (!OptimizeUtil.fileType(configValueUtil.getAllowUploadFileType(), fileType)) {
return ActionResult.fail(MsgCode.FA017.get());
}
TradeuploadCrForm tradeuploadCrForm = new TradeuploadCrForm();
String result = VatInvoice.weightNote(file);
// Map<String,Object> map = JsonUtil.stringToMap(result);
JSONObject jsonObject = JSON.parseObject(result);
UploaderVO vo = uploaderVO(file, type);
JSONArray jsonArray = jsonObject.getJSONArray("words_result");
JSONObject object = jsonArray.getJSONObject(0);
Map<String, Object> map1 = new HashMap<>();
for (int i = 0;i<object.size();i++) {
// JSONObject object = jsonArray.getJSONObject(i);
JSONArray array = new JSONArray();
if (i == 0) {
array = object.getJSONArray("TareWeight");
}else if(i == 1){
array = object.getJSONArray("CrossWeight");
}else if(i == 2){
array = object.getJSONArray("PlateNum");
}else if (i == 3){
array = object.getJSONArray("SendingCompany");
}else if (i == 4){
array = object.getJSONArray("DeliveryNumber");
}else if (i == 5){
array = object.getJSONArray("ReceivingCompany");
}else if (i == 6){
array = object.getJSONArray("PrintTime");
}else if (i == 7){
array = object.getJSONArray("NetWeight");
}
JSONObject object1 = array.getJSONObject(0);
Map<String, String> params = JSONObject.parseObject(object1.toJSONString(), new TypeReference<Map<String, String>>() {
});
if (i == 0) {
map1.put("TareWeight", params.get("word"));
}else if (i == 1){
map1.put("CrossWeight", params.get("word"));
}else if (i == 2){
map1.put("PlateNum", params.get("word"));
}else if (i == 3){
map1.put("SendingCompany", params.get("word"));
}else if (i == 4){
map1.put("DeliveryNumber", params.get("word"));
}else if (i == 5){
map1.put("ReceivingCompany", params.get("word"));
}else if (i == 6){
map1.put("PrintTime", params.get("word"));
}else if (i == 7){
map1.put("NetWeight", params.get("word"));
}
}
// List<VehicleEntity> list = JSONObject.parseArray(array.toJSONString(),VehicleEntity.class);
// JSONObject jsonObject = (JSONObject) map.get("words_result");
// JSONArray jsonArray = jsonObject.getJSONArray("words_result");
// List<VehicleEntity> list = JSONObject.parseArray(jsonArray.toJSONString(),VehicleEntity.class);
if(map1.size()>0) {
if (map1.get("ReceivingCompany")!= null) {
tradeuploadCrForm.setCustomerId(String.valueOf(map1.get("ReceivingCompany")));
QueryWrapper<CustomerEntity> customerQueryWrapper = new QueryWrapper<>();
customerQueryWrapper.lambda().eq(CustomerEntity::getSupplierNm, tradeuploadCrForm.getCustomerId());
CustomerEntity customerEntity = customerService.getOne(customerQueryWrapper);
if (customerEntity != null) {
tradeuploadCrForm.setCustomerId(customerEntity.getId());
tradeuploadCrForm.setCustomerName(customerEntity.getSupplierNm());
tradeuploadCrForm.setClientId(customerEntity.getId());
QueryWrapper<ContractFileEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ContractFileEntity::getCode, customerEntity.getId());
queryWrapper.lambda().eq(ContractFileEntity::getContractType, "1");
queryWrapper.lambda().eq(ContractFileEntity::getStatus, "1");
queryWrapper.lambda().orderByAsc(ContractFileEntity::getBidOpeningDate).last("limit 1");
ContractFileEntity contractFileEntity = contractFileService.getOne(queryWrapper);
if (contractFileEntity != null) {
tradeuploadCrForm.setSalesId(contractFileEntity.getId());
tradeuploadCrForm.setSalesName(contractFileEntity.getContractName());
}
}
}
if (map1.get("PlateNum")!= null) {
tradeuploadCrForm.setVehicleId(String.valueOf(map1.get("PlateNum")));
tradeuploadCrForm.setVehicleName(String.valueOf(map1.get("PlateNum")));
QueryWrapper<VehicleEntity> vehicleQueryWrapper = new QueryWrapper<>();
vehicleQueryWrapper.lambda().eq(VehicleEntity::getTicketno, map1.get("PlateNum"));
//vehicleQueryWrapper.lambda().eq(VehicleEntity::getTicketno, "鲁FEV620");
VehicleEntity vehicleEntity = vehicleService.getOne(vehicleQueryWrapper);
if (vehicleEntity != null) {
tradeuploadCrForm.setVehicleId(vehicleEntity.getId());
tradeuploadCrForm.setVehicleName(vehicleEntity.getTicketno());
tradeuploadCrForm.setVehiclePictures(vehicleEntity.getVehiclephotos());
}
}
if (map1.get("PrintTime") == null) {
tradeuploadCrForm.setPoundDate(new Date().getTime());
}
String printTime = String.valueOf(map1.get("PrintTime"));
String sdf = "yyyy-MM-dd" ;
if(printTime != null && printTime.length() == 10){
if (dateStrIsValid(printTime, sdf)) {
tradeuploadCrForm.setPoundDate(Long.valueOf(String.valueOf(map1.get("PrintTime"))));
}else {
tradeuploadCrForm.setPoundDate(new Date().getTime());
}
}else{
tradeuploadCrForm.setPoundDate(new Date().getTime());
}
if (map1.get("DeliveryNumber") == null) {
tradeuploadCrForm.setPoundlistNo(String.valueOf(new Date()));
}
tradeuploadCrForm.setPoundlistNo(String.valueOf(map1.get("DeliveryNumber")));
if (map1.get("TareWeight")!=null) {
tradeuploadCrForm.setTareWeight(String.valueOf(map1.get("TareWeight")));
}
if (map1.get("CrossWeight")!=null) {
tradeuploadCrForm.setGrossWeight(String.valueOf(map1.get("CrossWeight")));
}
if (map1.get("NetWeight") == null) {
tradeuploadCrForm.setBuckleWeight("0");
}
tradeuploadCrForm.setBuckleWeight(String.valueOf(map1.get("NetWeight")));
if (map1.get("NetWeight") != null) {
tradeuploadCrForm.setNetWeight(String.valueOf(map1.get("NetWeight")));
}
UserInfo userInfo = userProvider.get();
tradeuploadCrForm.setBusinessId(userInfo.getId());
tradeuploadCrForm.setBusinessName(userInfo.getUserName());
}
tradeuploadCrForm.setVo(vo);
return ActionResult.success(tradeuploadCrForm);
// return ActionResult.success(vo);
}
public boolean dateStrIsValid(String printTime, String sdf) {
SimpleDateFormat dateFormat = new SimpleDateFormat(sdf);
Date date = null;
try {
// 转化为 Date类型测试判断
date = dateFormat.parse(printTime);
return printTime.equals(dateFormat.format(date));
} catch (ParseException e) {
log.error("error{}",e.getMessage(),e);
return false;
}
}
/**
*
*
* @param file
* @param type
* @return
* @throws IOException
*/
private UploaderVO uploaderVO(MultipartFile file, String type) throws IOException {
String orgFileName = file.getOriginalFilename();
String fileType = UpUtil.getFileType(file);
// if (OptimizeUtil.fileSize(file.getSize(), 1024000)) {
// return ActionResult.fail("上传失败文件大小超过1M");
// }
String fileName = DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + "." + fileType;
if (type.equals(FileTypeEnum.MAIL)) {
type = FileTypeEnum.TEMPORARY;
}
String filePath = FilePathUtil.getFilePath(type.toLowerCase());
UploaderVO vo = UploaderVO.builder().name(fileName).build();
//上传文件
UploadUtil.uploadFile(configValueUtil.getFileType(), type, fileName, file, filePath);
if (type.equalsIgnoreCase(FileTypeEnum.USERAVATAR)) {
vo.setUrl(UploaderUtil.uploaderImg(fileName));
} else if (type.equalsIgnoreCase(FileTypeEnum.ANNEX)) {
// UserInfo userInfo = userProvider.get();
// vo.setUrl(UploaderUtil.uploaderFile(userInfo.getId() + "#" + fileName + "#" + type));
vo.setUrl(UploaderUtil.uploaderImg("/api/file/Image/annex/", fileName));
} else if (type.equalsIgnoreCase(FileTypeEnum.ANNEXPIC)) {
vo.setUrl(UploaderUtil.uploaderImg("/api/file/Image/annex/", fileName));
}else {
vo.setUrl(UploaderUtil.uploaderImg("/api/file/Image/"+type.toLowerCase()+"/", fileName));
}
//上传到永中
if ("yozo".equals(configValueUtil.getAllowPreviewFileType())) {
try {
@Cleanup InputStream inputStream = file.getInputStream();
String s = yozoUtils.uploadFileInPreview(inputStream, orgFileName);
Map<String, Object> map = JsonUtil.stringToMap(s);
if ("操作成功".equals(map.get("message"))) {
Map<String, Object> dataMap = JsonUtil.stringToMap(String.valueOf(map.get("data")));
String verId = String.valueOf(dataMap.get("fileVersionId"));
vo.setFileVersionId(verId);
}
} catch (Exception e) {
System.out.println("上传到永中失败");
e.printStackTrace();
}
}
return vo;
}
/**
*
*
* @param file
* @return
*/
@ApiOperation("磅单识别")
@PostMapping("/poundai")
public ActionResult poundAI(MultipartFile file ) throws ModelException, TranslateException, IOException {
TradeuploadCrForm tradeuploadCrForm = new TradeuploadCrForm();
String result = VatInvoice.weightNote(file);
Map<String,Object> map = JsonUtil.stringToMap(result);
tradeuploadCrForm.setCustomerId(String.valueOf(map.get("ReceivingCompany")));
QueryWrapper<CustomerEntity> customerQueryWrapper = new QueryWrapper<>();
customerQueryWrapper.lambda().eq(CustomerEntity::getSupplierNm,tradeuploadCrForm.getCustomerId());
CustomerEntity customerEntity = customerService.getOne(customerQueryWrapper);
tradeuploadCrForm.setClientId(customerEntity.getId());
QueryWrapper<ContractFileEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ContractFileEntity::getCode,customerEntity.getId());
queryWrapper.lambda().eq(ContractFileEntity::getContractType,"1");
queryWrapper.lambda().eq(ContractFileEntity::getStatus,"1");
queryWrapper.lambda().orderByAsc(ContractFileEntity::getBidOpeningDate).last("limit 1");
ContractFileEntity contractFileEntity = contractFileService.getOne(queryWrapper);
tradeuploadCrForm.setSalesId(contractFileEntity.getContractName());
tradeuploadCrForm.setVehicleId(String.valueOf(map.get("PlateNum")));
QueryWrapper<VehicleEntity> vehicleQueryWrapper = new QueryWrapper<>();
vehicleQueryWrapper.lambda().eq(VehicleEntity::getTicketno,map.get("PlateNum"));
VehicleEntity vehicleEntity = vehicleService.getOne(vehicleQueryWrapper);
if (vehicleEntity != null){
tradeuploadCrForm.setVehiclePictures(vehicleEntity.getVehiclephotos());
}
if (map.get("PrintTime") == null){
tradeuploadCrForm.setPoundDate(new Date().getTime());
}
tradeuploadCrForm.setPoundDate((Long) map.get("PrintTime"));
if (map.get("DeliveryNumber") == null){
tradeuploadCrForm.setPoundlistNo(String.valueOf(new Date()));
}
tradeuploadCrForm.setPoundlistNo(String.valueOf(map.get("DeliveryNumber")));
tradeuploadCrForm.setTareWeight(String.valueOf(map.get("TareWeight")));
tradeuploadCrForm.setGrossWeight(String.valueOf(map.get("CrossWeight")));
if (map.get("NetWeight") == null){
tradeuploadCrForm.setBuckleWeight("0");
}
tradeuploadCrForm.setBuckleWeight(String.valueOf(map.get("NetWeight")));
if (map.get("NetWeight") == null){
tradeuploadCrForm.setNetWeight("0");
}
tradeuploadCrForm.setNetWeight(String.valueOf(map.get("NetWeight")));
UserInfo userInfo = userProvider.get();
tradeuploadCrForm.setBusinessId(userInfo.getUserName());
return ActionResult.success(tradeuploadCrForm);
}
/**
@ -88,7 +391,7 @@ public class TradeuploadController {
for(TradeuploadEntity entity:list){
entity.setPoundPictures(generaterSwapUtil.getFileNameInJson(entity.getPoundPictures()));
Map<String,Object> materialIdMap = new HashMap<>();
entity.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","description",entity.getMaterialId(),materialIdMap));
entity.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",entity.getMaterialId(),materialIdMap));
Map<String,Object> customerIdMap = new HashMap<>();
entity.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",entity.getCustomerId(),customerIdMap));
Map<String,Object> salesIdMap = new HashMap<>();
@ -97,7 +400,7 @@ public class TradeuploadController {
entity.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",entity.getVehicleId(),vehicleIdMap));
entity.setVehiclePictures(generaterSwapUtil.getFileNameInJson(entity.getVehiclePictures()));
Map<String,Object> creatorUserNameMap = new HashMap<>();
entity.setCreatorUserName(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_RealName","F_RealName",entity.getCreatorUserName(),creatorUserNameMap));
entity.setCreatorUserName(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",entity.getCreatorUserName(),creatorUserNameMap));
Map<String,Object> naturalIdMap = new HashMap<>();
entity.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",entity.getNaturalId(),naturalIdMap));
}
@ -127,10 +430,15 @@ public class TradeuploadController {
UserInfo userInfo=userProvider.get();
tradeuploadCrForm.setCreatorTime(DateUtil.getNow());
TradeuploadEntity entity = JsonUtil.getJsonToBean(tradeuploadCrForm, TradeuploadEntity.class);
QueryWrapper<TradeuploadEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TradeuploadEntity::getPoundlistNo,entity.getPoundlistNo());
queryWrapper.lambda().eq(TradeuploadEntity::getCustomerId,entity.getCustomerId());
List<TradeuploadEntity> list = tradeuploadService.list(queryWrapper);
if (list != null && list.size()>0){
return ActionResult.fail("磅单重复");
}
entity.setId(mainId);
tradeuploadService.save(entity);
return ActionResult.success("创建成功");
}
@ -171,7 +479,7 @@ public class TradeuploadController {
for(TradeuploadEntity entity:list){
entity.setPoundPictures(generaterSwapUtil.getFileNameInJson(entity.getPoundPictures()));
Map<String,Object> materialIdMap = new HashMap<>();
entity.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","description",entity.getMaterialId(),materialIdMap));
entity.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",entity.getMaterialId(),materialIdMap));
Map<String,Object> customerIdMap = new HashMap<>();
entity.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",entity.getCustomerId(),customerIdMap));
Map<String,Object> salesIdMap = new HashMap<>();
@ -180,7 +488,7 @@ public class TradeuploadController {
entity.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",entity.getVehicleId(),vehicleIdMap));
entity.setVehiclePictures(generaterSwapUtil.getFileNameInJson(entity.getVehiclePictures()));
Map<String,Object> creatorUserNameMap = new HashMap<>();
entity.setCreatorUserName(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_RealName","F_RealName",entity.getCreatorUserName(),creatorUserNameMap));
entity.setCreatorUserName(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",entity.getCreatorUserName(),creatorUserNameMap));
Map<String,Object> naturalIdMap = new HashMap<>();
entity.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",entity.getNaturalId(),naturalIdMap));
}
@ -355,7 +663,7 @@ public class TradeuploadController {
//添加到详情表单对象中
vo.setPoundPictures(generaterSwapUtil.getFileNameInJson(vo.getPoundPictures()));
Map<String,Object> materialIdMap = new HashMap<>();
vo.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","description",vo.getMaterialId(),materialIdMap));
vo.setMaterialId(generaterSwapUtil.getPopupSelectValue("381037852907038533","id","item_name",vo.getMaterialId(),materialIdMap));
Map<String,Object> customerIdMap = new HashMap<>();
vo.setCustomerId(generaterSwapUtil.getPopupSelectValue("395936123471343749","id","supplier_nm",vo.getCustomerId(),customerIdMap));
Map<String,Object> salesIdMap = new HashMap<>();
@ -364,7 +672,7 @@ public class TradeuploadController {
vo.setVehicleId(generaterSwapUtil.getPopupSelectValue("381432451370615173","id","ticketno",vo.getVehicleId(),vehicleIdMap));
vo.setVehiclePictures(generaterSwapUtil.getFileNameInJson(vo.getVehiclePictures()));
Map<String,Object> creatorUserNameMap = new HashMap<>();
vo.setCreatorUserName(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_RealName","F_RealName",vo.getCreatorUserName(),creatorUserNameMap));
vo.setBusinessId(generaterSwapUtil.getPopupSelectValue("ebcc44be142e43b795c0d769abd6d25a","F_Id","F_RealName",vo.getBusinessId(),creatorUserNameMap));
Map<String,Object> naturalIdMap = new HashMap<>();
vo.setNaturalId(generaterSwapUtil.getPopupSelectValue("395933800510599301","id","name",vo.getNaturalId(),naturalIdMap));
@ -388,6 +696,13 @@ public class TradeuploadController {
if(entity!=null){
TradeuploadEntity subentity=JsonUtil.getJsonToBean(tradeuploadUpForm, TradeuploadEntity.class);
subentity.setCreatorTime(entity.getCreatorTime());
QueryWrapper<TradeuploadEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(TradeuploadEntity::getPoundlistNo,entity.getPoundlistNo());
queryWrapper.lambda().eq(TradeuploadEntity::getCustomerId,entity.getCustomerId());
List<TradeuploadEntity> list = tradeuploadService.list(queryWrapper);
if (list != null && list.size()>0 && !ObjectUtil.equal("id", list.get(0).getId())){
return ActionResult.fail("磅单重复");
}
tradeuploadService.update(id, subentity);
return ActionResult.success("更新成功");
}else{

@ -186,4 +186,5 @@ public class TradeuploadEntity {
@TableField("IS_EXPENSE")
private String isExpense;
}

@ -4,6 +4,8 @@ package jnpf.tradeupload.mapper;
import jnpf.tradeupload.entity.TradeuploadEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
*
* tradeupload
@ -13,5 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* 2023-02-16
*/
public interface TradeuploadMapper extends BaseMapper<TradeuploadEntity> {
List<TradeuploadEntity> queryVehicle(TradeuploadEntity tradeuploadEntity);
}

@ -2,6 +2,8 @@
package jnpf.tradeupload.model.tradeupload;
import com.baomidou.mybatisplus.annotation.TableField;
import jnpf.model.UploaderVO;
import lombok.Data;
import java.util.List;
import java.math.BigDecimal;
@ -19,6 +21,10 @@ import com.fasterxml.jackson.annotation.JsonProperty;
@Data
public class TradeuploadCrForm {
/** 磅单上传 **/
@JsonProperty("id")
private String id;
/** 磅单上传 **/
@JsonProperty("poundPictures")
private String poundPictures;
@ -35,10 +41,18 @@ public class TradeuploadCrForm {
@JsonProperty("salesId")
private String salesId;
/** 销售合同 **/
@JsonProperty("salesName")
private String salesName;
/** 车牌号 **/
@JsonProperty("vehicleId")
private String vehicleId;
/** 车牌号 **/
@JsonProperty("vehicleName")
private String vehicleName;
/** 车辆图片 **/
@JsonProperty("vehiclePictures")
private String vehiclePictures;
@ -88,8 +102,12 @@ public class TradeuploadCrForm {
private String salesPrice;
/** 业务员 **/
@JsonProperty("creatorUserName")
private String creatorUserName;
@JsonProperty("businessId")
private String businessId;
/** 业务员 **/
@JsonProperty("businessName")
private String businessName;
/** 自然人 **/
@JsonProperty("naturalId")
@ -103,6 +121,18 @@ public class TradeuploadCrForm {
@JsonProperty("creatorTime")
private String creatorTime;
/** 客户ID **/
@TableField(exist = false)
private String clientId;
/** 客户名称 **/
@JsonProperty("customerName")
private String customerName;
/** 备注 **/
@JsonProperty("vo")
private UploaderVO vo;
}

@ -92,8 +92,8 @@ public class TradeuploadInfoVO{
private String salesPrice;
/** 业务员 **/
@JsonProperty("creatorUserName")
private String creatorUserName;
@JsonProperty("businessId")
private String businessId;
/** 自然人 **/
@JsonProperty("naturalId")

@ -111,8 +111,8 @@ public class TradeuploadListVO{
/** 业务员 **/
@JsonProperty("creatorUserName")
private String creatorUserName;
@JsonProperty("businessId")
private String businessId;
/** 自然人 **/

@ -109,8 +109,8 @@ public class TradeuploadUpForm{
/** 业务员 **/
@JsonProperty("creatorUserName")
private String creatorUserName;
@JsonProperty("businessId")
private String businessId;
/** 自然人 **/

@ -16,7 +16,7 @@ public interface TradeuploadService extends IService<TradeuploadEntity> {
List<TradeuploadEntity> getList(TradeuploadPagination tradeuploadPagination);
List<TradeuploadEntity> getTypeList(TradeuploadPagination tradeuploadPagination,String dataType);
List<TradeuploadEntity> getTypeList(TradeuploadPagination tradeuploadPagination, String dataType);
@ -26,7 +26,9 @@ public interface TradeuploadService extends IService<TradeuploadEntity> {
void create(TradeuploadEntity entity);
boolean update( String id, TradeuploadEntity entity);
boolean update(String id, TradeuploadEntity entity);
List<TradeuploadEntity> queryVehicleInfo(TradeuploadEntity tradeuploadEntity);
// 子表方法

@ -30,6 +30,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.text.SimpleDateFormat;
import jnpf.util.*;
import javax.annotation.Resource;
import java.util.*;
/**
@ -50,6 +52,9 @@ public class TradeuploadServiceImpl extends ServiceImpl<TradeuploadMapper, Trade
@Autowired
private AuthorizeService authorizeService;
@Resource
private TradeuploadMapper tradeuploadMapper;
@ -61,6 +66,8 @@ public class TradeuploadServiceImpl extends ServiceImpl<TradeuploadMapper, Trade
int total=0;
int tradeuploadNum =0;
QueryWrapper<TradeuploadEntity> tradeuploadQueryWrapper=new QueryWrapper<>();
tradeuploadQueryWrapper.lambda().eq(TradeuploadEntity::getIsExamine,"0");
tradeuploadQueryWrapper.lambda().eq(TradeuploadEntity::getPoundType,"0");
boolean pcPermission = false;
boolean appPermission = false;
boolean isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
@ -230,6 +237,12 @@ public class TradeuploadServiceImpl extends ServiceImpl<TradeuploadMapper, Trade
entity.setId(id);
return this.updateById(entity);
}
@Override
public List<TradeuploadEntity> queryVehicleInfo(TradeuploadEntity tradeuploadEntity) {
return tradeuploadMapper.queryVehicle(tradeuploadEntity) ;
}
@Override
public void delete(TradeuploadEntity entity){
if(entity!=null){

@ -2,6 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.tradeupload.mapper.TradeuploadMapper">
<select id="queryVehicle" resultType="jnpf.tradeupload.entity.TradeuploadEntity">
select
*
from
jg_poundlist
where
vehicle_id = #{vehicleId} and
gross_weight = #{grossWeight} and
tare_weight = #{tareWeight} and
net_weight = #{netWeight} and
creator_time = DATE_SUB(NOW(),interval 15 day)
</select>
</mapper>

@ -116,8 +116,8 @@
</el-col>
<el-col :span="12" >
<el-form-item label="业务员"
prop="creatorUserName" >
<p>{{dataForm.creatorUserName}}</p>
prop="businessId" >
<p>{{dataForm.businessId}}</p>
</el-form-item>
</el-col>
<el-col :span="12" >
@ -178,7 +178,7 @@
advance : "0",
transportPrice : 0,
salesPrice : '',
creatorUserName : "",
businessId : "",
naturalId : "",
remark : '',
creatorTime : "",

@ -1,379 +1,482 @@
<template>
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'"
:close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
width="1000px">
<el-row :gutter="15" class="">
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px" label-position="right" >
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" append-to-body
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="1500px">
<el-row :gutter="15" class="">
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px" label-position="right">
<template v-if="!loading">
<el-col :span="24" >
<el-form-item label="磅单上传"
prop="poundPictures" >
<JNPF-UploadImg v-model="dataForm.poundPictures"
:fileSize="500" sizeUnit="MB" :limit="9" buttonText="点击上传" >
</JNPF-UploadImg>
<el-col :span="24">
<el-form-item label="磅单上传" prop="poundPictures">
<el-upload class="avatar-uploader" :action="action" :show-file-list="false"
:on-success="handleAvatarSuccess">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="物料名称"
prop="materialId" >
<popupSelect v-model="dataForm.materialId"
placeholder="请选择物料编码" clearable field="materialId" interfaceId="381037852907038533" :columnOptions="materialIdcolumnOptions" propsValue="id" relationField="description" popupType="dialog"
popupTitle="选择数据" popupWidth="800px"
hasPage :pageSize="20" >
<el-col :span="12">
<el-form-item label="物料名称" prop="materialId">
<popupSelect v-model="dataForm.materialId" placeholder="请选择物料编码" clearable field="materialId"
interfaceId="381037852907038533" :columnOptions="materialIdcolumnOptions" propsValue="id"
relationField="item_name" popupType="dialog" popupTitle="选择数据" popupWidth="800px" hasPage
:pageSize="20">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="客户名称"
prop="customerId" >
<popupSelect v-model="dataForm.customerId"
placeholder="请选择客户" clearable field="customerId" interfaceId="395936123471343749" :columnOptions="customerIdcolumnOptions" propsValue="id" relationField="supplier_nm" popupType="dialog"
popupTitle="选择数据" popupWidth="800px"
hasPage :pageSize="20" >
<el-col :span="12">
<el-form-item label="客户名称" prop="customerId">
<popupSelect v-model="dataForm.customerId" placeholder="请选择客户" clearable field="customerId"
interfaceId="395936123471343749" :columnOptions="customerIdcolumnOptions" propsValue="id"
relationField="supplier_nm" popupType="dialog" popupTitle="选择数据" popupWidth="800px" hasPage
:pageSize="20" @change="customerSelect">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="销售合同"
prop="salesId" >
<popupSelect v-model="dataForm.salesId"
placeholder="请选择合同" clearable field="salesId" interfaceId="381037852907038533" :columnOptions="salesIdcolumnOptions" propsValue="id" relationField="contract_name" popupType="dialog"
popupTitle="选择数据" popupWidth="800px"
hasPage :pageSize="20" >
<el-col :span="12">
<el-form-item label="销售合同" prop="salesId">
<popupSelect v-model="dataForm.salesId" placeholder="请选择合同" clearable field="salesId"
interfaceId="396203872441416837" :columnOptions="salesIdcolumnOptions" propsValue="id"
relationField="contract_name" popupType="dialog" popupTitle="选择数据" popupWidth="800px" :bissId="dataForm.customerId"
hasPage :pageSize="20">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="车牌号"
prop="vehicleId" >
<popupSelect v-model="dataForm.vehicleId"
placeholder="请选择车辆" clearable field="vehicleId" interfaceId="381432451370615173" :columnOptions="vehicleIdcolumnOptions" propsValue="id" relationField="ticketno" popupType="dialog"
popupTitle="选择数据" popupWidth="800px"
hasPage :pageSize="20" >
<el-col :span="12">
<el-form-item label="车牌号" prop="vehicleId">
<popupSelect v-model="dataForm.vehicleId" placeholder="请选择车辆" clearable field="vehicleId"
interfaceId="381432451370615173" :columnOptions="vehicleIdcolumnOptions" propsValue="id"
relationField="ticketno" popupType="dialog" popupTitle="选择数据" popupWidth="800px" @change="changePicture"
hasPage :pageSize="20">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="车辆图片"
prop="vehiclePictures" >
<JNPF-UploadImg v-model="dataForm.vehiclePictures"
:fileSize="500" sizeUnit="MB" :limit="9" >
<el-col :span="24">
<el-form-item label="车辆图片" prop="vehiclePictures">
<JNPF-UploadImg v-model="dataForm.vehiclePictures" :fileSize="500" sizeUnit="MB" :limit="9">
</JNPF-UploadImg>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="磅单时间"
prop="poundDate" >
<el-date-picker v-model="dataForm.poundDate"
placeholder="请选择" clearable :style='{"width":"100%"}' type="date" format="yyyy-MM-dd" value-format="timestamp" >
<el-col :span="12">
<el-form-item label="磅单时间" prop="poundDate">
<el-date-picker v-model="dataForm.poundDate" placeholder="请选择" clearable :style='{"width":"100%"}'
type="date" format="yyyy-MM-dd" value-format="timestamp">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="磅单号"
prop="poundlistNo" >
<el-input v-model="dataForm.poundlistNo"
placeholder="请输入" clearable :style='{"width":"100%"}'>
<el-col :span="12">
<el-form-item label="磅单号" prop="poundlistNo">
<el-input v-model="dataForm.poundlistNo" placeholder="请输入" clearable :style='{"width":"100%"}'>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="皮重"
prop="tareWeight" >
<el-input v-model="dataForm.tareWeight"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</el-input>
<el-col :span="12">
<el-form-item label="皮重" prop="tareWeight">
<el-input-number v-model="dataForm.tareWeight" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="毛重"
prop="grossWeight" >
<el-input v-model="dataForm.grossWeight"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</el-input>
<el-col :span="12">
<el-form-item label="毛重" prop="grossWeight">
<el-input-number v-model="dataForm.grossWeight" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="扣重"
prop="buckleWeight" >
<el-input v-model="dataForm.buckleWeight"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</el-input>
<el-col :span="12">
<el-form-item label="扣重" prop="buckleWeight">
<el-input-number v-model="dataForm.buckleWeight" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="净重"
prop="netWeight" >
<el-input v-model="dataForm.netWeight"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</el-input>
<el-col :span="12">
<el-form-item label="净重" prop="netWeight">
<el-input-number v-model="dataForm.netWeight" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="单位 "
prop="unit" >
<el-select v-model="dataForm.unit"
placeholder="请选择" clearable :style='{"width":"100%"}'>
<el-option v-for="(item, index) in unitOptions" :key="index" :label="item.fullName" :value="item.id" :disabled="item.disabled" ></el-option>
<el-col :span="12">
<el-form-item label="单位 " prop="unit">
<el-select v-model="unit" placeholder="请选择" clearable :style='{"width":"100%"}' @change="unitChange">
<el-option v-for="(item, index) in unitOptions" :key="index" :label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="运输类型"
prop="transportType" >
<el-select v-model="dataForm.transportType"
placeholder="请选择" clearable :style='{"width":"100%"}'>
<el-option v-for="(item, index) in transportTypeOptions" :key="index" :label="item.fullName" :value="item.id" :disabled="item.disabled" ></el-option>
<el-col :span="12">
<el-form-item label="运输类型" prop="transportType">
<el-select v-model="transportType" placeholder="请选择" clearable :style='{"width":"100%"}' @change="transportTypeChange">
<el-option v-for="(item, index) in transportTypeOptions" :key="index" :label="item.fullName"
:value="item.id" :disabled="item.disabled"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="是否垫资"
prop="advance" >
<el-select v-model="dataForm.advance"
placeholder="请选择" clearable :style='{"width":"100%"}'>
<el-option v-for="(item, index) in advanceOptions" :key="index" :label="item.fullName" :value="item.id" :disabled="item.disabled" ></el-option>
<el-col :span="12">
<el-form-item label="是否垫资" prop="advance" @change="advanceChange">
<el-select v-model="advance" placeholder="请选择" clearable :style='{"width":"100%"}'>
<el-option v-for="(item, index) in advanceOptions" :key="index" :label="item.fullName" :value="item.id"
:disabled="item.disabled"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="运费"
prop="transportPrice" >
<el-input v-model="dataForm.transportPrice"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</el-input>
<el-col :span="12">
<el-form-item label="运费" prop="transportPrice">
<el-input-number v-model="dataForm.transportPrice" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="销售价格"
prop="salesPrice" >
<el-input v-model="dataForm.salesPrice"
placeholder="请输入" clearable :style='{"width":"100%"}'>
</el-input>
<el-col :span="12">
<el-form-item label="销售价格" prop="salesPrice">
<el-input-number v-model="dataForm.salesPrice" :style='{"width":"100%"}'></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="业务员"
prop="creatorUserName" >
<popupSelect v-model="dataForm.creatorUserName"
placeholder="请选择业务员" clearable field="creatorUserName" interfaceId="ebcc44be142e43b795c0d769abd6d25a" :columnOptions="creatorUserNamecolumnOptions" propsValue="F_RealName" relationField="F_RealName" popupType="dialog"
popupTitle="选择数据" popupWidth="800px"
hasPage :pageSize="20" >
<el-col :span="12">
<el-form-item label="业务员" prop="businessId">
<popupSelect v-model="dataForm.businessId" placeholder="请选择业务员" clearable field="businessId"
interfaceId="ebcc44be142e43b795c0d769abd6d25a" :columnOptions="businessIdcolumnOptions"
propsValue="F_Id" relationField="F_RealName" popupType="dialog" popupTitle="选择数据" popupWidth="800px"
hasPage :pageSize="20" :bissId="dataForm.businessId">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="自然人"
prop="naturalId" >
<popupSelect v-model="dataForm.naturalId"
placeholder="请选择自然人" clearable field="naturalId" interfaceId="395933800510599301" :columnOptions="naturalIdcolumnOptions" propsValue="id" relationField="name" popupType="dialog"
popupTitle="选择数据" popupWidth="800px"
hasPage :pageSize="20" >
<el-col :span="12">
<el-form-item label="自然人" prop="naturalId">
<popupSelect v-model="dataForm.naturalId" placeholder="请选择自然人" clearable field="naturalId"
interfaceId="395933800510599301" :columnOptions="naturalIdcolumnOptions" propsValue="id"
relationField="name" popupType="dialog" popupTitle="选择数据" popupWidth="800px" hasPage :pageSize="20">
</popupSelect>
</el-form-item>
</el-col>
<el-col :span="12" >
<el-form-item label="备注"
prop="remark" >
<el-input v-model="dataForm.remark"
placeholder="请输入备注信息" clearable :style='{"width":"100%"}'>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="磅单日期"
prop="creatorTime" >
<el-input v-model="dataForm.creatorTime"
placeholder="系统自动生成" readonly >
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注信息" clearable :style='{"width":"100%"}'>
</el-input>
</el-form-item>
</el-col>
</template>
</el-form>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false"> </el-button>
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail"> </el-button>
<el-button type="primary" @click="continueUpload()"> </el-button>
</span>
</el-dialog>
</template>
<script>
import request from '@/utils/request'
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
import {
getDataInterfaceRes
} from '@/api/systemData/dataInterface'
import {
getDictionaryDataSelector
} from '@/api/systemData/dictionary'
export default {
components: {},
props: [],
data() {
return {
unit: "0",
transportType: "0",
advance: "0",
action: this.define.APIURl + '/api/tradeupload/Tradeupload/UploaderPondList/annexpic',
imageUrl: '',
code: '100',
fileList: [],
visible: false,
loading: false,
isDetail: false,
dataForm: {
poundPictures : [],
materialId : "",
customerId : "",
salesId : "",
vehicleId : "",
vehiclePictures : [],
poundDate : '',
poundlistNo : '',
tareWeight : 0,
grossWeight : 0,
buckleWeight : 0,
netWeight : 0,
unit : "0",
transportType : "0",
advance : "0",
transportPrice : 0,
salesPrice : '',
creatorUserName : "",
naturalId : "",
remark : '',
creatorTime : "",
poundPictures: [],
materialId: "",
customerId: "",
salesId: "",
vehicleId: "",
vehiclePictures: [],
poundDate: '',
poundlistNo: '',
tareWeight: 0,
grossWeight: 0,
buckleWeight: 0,
netWeight: 0,
unit: "0",
transportType: "0",
advance: "0",
transportPrice: 0,
salesPrice: 0,
businessId: "",
naturalId: "",
remark: '',
creatorTime: "",
},
rules:
{
poundPictures: [
{
required: true,
message: '请至少选择一个',
trigger: 'click'
},
],
materialId: [
{
rules: {
materialId: [{
required: true,
message: '请选择物料编码',
trigger: 'change'
},
],
customerId: [
{
}, ],
customerId: [{
required: true,
message: '请选择客户',
trigger: 'change'
},
],
salesId: [
{
}, ],
salesId: [{
required: true,
message: '请选择合同',
trigger: 'change'
},
],
vehicleId: [
{
}, ],
vehicleId: [{
required: true,
message: '请选择车辆',
trigger: 'change'
},
],
vehiclePictures: [
{
}, ],
vehiclePictures: [{
required: true,
message: '请至少选择一个',
trigger: 'click'
},
],
poundDate: [
{
}, ],
poundDate: [{
required: true,
message: '请选择',
trigger: 'change'
},
],
poundlistNo: [
{
}, ],
poundlistNo: [{
required: true,
message: '请输入',
trigger: 'blur'
},
],
tareWeight: [
{
}, ],
tareWeight: [{
required: true,
message: '请输入',
trigger: 'blur'
},
],
grossWeight: [
{
}, ],
grossWeight: [{
required: true,
message: '请输入',
trigger: 'blur'
},
],
buckleWeight: [
{
}, ],
buckleWeight: [{
required: true,
message: '请输入',
trigger: 'blur'
},
],
netWeight: [
{
}, ],
netWeight: [{
required: true,
message: '请输入',
trigger: 'blur'
},
],
salesPrice: [
{
}, ],
salesPrice: [{
required: true,
message: '请输入',
trigger: 'blur'
},
],
creatorUserName: [
{
}, ],
businessId: [{
required: true,
message: '请选择业务员',
trigger: 'change'
}, ],
},
],
},
materialIdcolumnOptions:[ {"label":"物料编码","value":"item_code"}, {"label":"物料名称","value":"item_name"}, {"label":"默认库区","value":"areaname"}, {"label":"库存组织","value":"organization_id"},],
customerIdcolumnOptions:[ {"label":"客户编码","value":"supplier_cd"}, {"label":"客户名称","value":"supplier_nm"}, {"label":"地址","value":"address"}, {"label":"银行账号","value":"bank_account"},],
salesIdcolumnOptions:[ {"label":"合同编码","value":"contract_code"}, {"label":"合同名称","value":"contract_name"}, {"label":"合同类型","value":"contract_type"}, {"label":"供应商/客户名称","value":"name"},],
vehicleIdcolumnOptions:[ {"label":"车牌号","value":"ticketno"}, {"label":"司机","value":"drivername"}, {"label":"车辆照片","value":"vehiclephotos"}, {"label":"手机号","value":"contact"},],
unitOptions:[{"fullName":"吨","id":"0"},{"fullName":"千克","id":"1"}],
transportTypeOptions:[{"fullName":"汽运","id":"0"},{"fullName":"船运","id":"1"},{"fullName":"火车","id":"2"}],
advanceOptions:[{"fullName":"否","id":"0"},{"fullName":"是","id":"1"}],
creatorUserNamecolumnOptions:[ {"label":"人员名称","value":"F_RealName"}, {"label":"人员职位","value":"F_FullName"},],
naturalIdcolumnOptions:[ {"label":"自然人名称","value":"name"}, {"label":"自然人手机号","value":"contact"}, {"label":"自然人地址","value":"adress"},],
materialIdcolumnOptions: [{
"label": "物料编码",
"value": "item_code"
}, {
"label": "物料名称",
"value": "item_name"
}, {
"label": "单位",
"value": "primary_unit_of_measure"
}, {
"label": "默认入库区",
"value": "in_area"
}, {
"label": "默认出库区",
"value": "out_area"
}, ],
customerIdcolumnOptions: [{
"label": "客户编码",
"value": "supplier_cd"
}, {
"label": "客户名称",
"value": "supplier_nm"
}, {
"label": "地址",
"value": "address"
}, {
"label": "银行账号",
"value": "bank_account"
}, ],
salesIdcolumnOptions: [{
"label": "合同编码",
"value": "contract_code"
}, {
"label": "合同名称",
"value": "contract_name"
}, {
"label": "合同类型",
"value": "contract_type"
}, {
"label": "供应商/客户名称",
"value": "name"
}, ],
vehicleIdcolumnOptions: [{
"label": "车牌号",
"value": "ticketno"
}, {
"label": "司机",
"value": "drivername"
}, {
"label": "车辆照片",
"value": "vehiclephotos"
}, {
"label": "手机号",
"value": "contact"
}, ],
unitOptions: [{
"fullName": "吨",
"id": "0"
}, {
"fullName": "千克",
"id": "1"
}],
transportTypeOptions: [{
"fullName": "汽运",
"id": "0"
}, {
"fullName": "船运",
"id": "1"
}, {
"fullName": "火车",
"id": "2"
}],
advanceOptions: [{
"fullName": "否",
"id": "0"
}, {
"fullName": "是",
"id": "1"
}],
businessIdcolumnOptions: [{
"label": "人员名称",
"value": "F_RealName"
}, {
"label": "人员职位",
"value": "F_FullName"
}, ],
naturalIdcolumnOptions: [{
"label": "自然人名称",
"value": "name"
}, {
"label": "自然人手机号",
"value": "contact"
}, {
"label": "自然人地址",
"value": "adress"
}, ],
}
},
computed: {},
watch: {},
created() {
},
created() {},
mounted() {},
methods: {
clearData(data){
unitChange(e){
this.dataForm.unit = e;
},
transportTypeChange(e){
this.dataForm.transportType = e;
},
advanceChange(e){
this.dataForm.advance = e;
},
customerSelect(e, d) {
const query = {
code: d.id
}
request({
url: '/api/example/ContractFile/getListByCustomer',
method: 'post',
data: query
}).then((res) => {
if(res.data.length > 0){
// type
this.dataForm.salesId = res.data[0].id
this.dataForm.salesName = res.data[0].contractName
}
})
},
handleAvatarSuccess(res, file) {
this.imageUrl = URL.createObjectURL(file.raw);
this.dataForm.customerId = res.data.customerId;
this.dataForm.customerName = res.data.customerName;
this.dataForm.salesId = res.data.salesId;
this.dataForm.salesName = res.data.salesName;
this.dataForm.vehicleId = res.data.vehicleId;
this.dataForm.poundDate = res.data.poundDate;
this.dataForm.poundlistNo = res.data.poundlistNo;
this.dataForm.tareWeight = res.data.tareWeight;
this.dataForm.grossWeight = res.data.grossWeight;
this.dataForm.buckleWeight = res.data.buckleWeight;
this.dataForm.netWeight = res.data.netWeight;
this.dataForm.vehiclePictures = JSON.parse(res.data.vehiclePictures);
},
changePicture(a, b) {
this.dataForm.vehiclePictures = JSON.parse(b.vehiclephotos);
},
continueUpload() {
var tareWeight = this.dataForm.tareWeight;//
var grossWeight = this.dataForm.grossWeight;//
var buckleWeight = this.dataForm.buckleWeight;//
var netWeight = this.dataForm.netWeight;//
if(grossWeight < tareWeight + buckleWeight + netWeight){
this.$message({
message: '毛重不得小于皮重+扣重+净重',
type: 'success',
duration: 1000
})
return
}
if(buckleWeight >= netWeight){
this.$message({
message: '扣重不得大于净重',
type: 'success',
duration: 1000
})
return
}
if(buckleWeight >= grossWeight){
this.$message({
message: '扣重不得大于毛重',
type: 'success',
duration: 1000
})
return
}
this.$refs['elForm'].validate((valid) => {
if (valid) {
this.request3()
}
})
},
// poundAI(){
// let formData = new FormData();
// let file = this.dataForm.poundPictures
// formData.append('file',file);
// request({
// url: '/api/tradeupload/Tradeupload/poundai',
// method: 'post',
// data: formData
// }).then(res => {
// this.dataInfo(res.data)
// this.loading = false
// });
// },
clearData(data) {
for (let key in data) {
if (data[key] instanceof Array) {
data[key] = [];
@ -385,21 +488,24 @@
}
},
init(id, isDetail) {
this.dataForm.businessId = this.$store.state.user.userInfo.userId;
this.dataForm.businessName = this.$store.state.user.userInfo.userName;
this.dataForm.poundDate = new Date();
this.dataForm.id = id || 0;
this.visible = true;
this.isDetail = isDetail || false;
this.$nextTick(() => {
this.$refs['elForm'].resetFields();
if(this.dataForm.id){
if (this.dataForm.id) {
this.loading = true
request({
url: '/api/tradeupload/Tradeupload/'+this.dataForm.id,
url: '/api/tradeupload/Tradeupload/' + this.dataForm.id,
method: 'get'
}).then(res => {
this.dataInfo(res.data)
this.loading = false
});
}else{
} else {
this.clearData(this.dataForm)
}
});
@ -407,14 +513,114 @@
},
//
dataFormSubmit() {
var tareWeight = this.dataForm.tareWeight;//
var grossWeight = this.dataForm.grossWeight;//
var buckleWeight = this.dataForm.buckleWeight;//
var netWeight = this.dataForm.netWeight;//
if(grossWeight < tareWeight + buckleWeight + netWeight){
this.$message({
message: '毛重不得小于皮重+扣重+净重',
type: 'success',
duration: 1000
})
return
}
if(buckleWeight >= netWeight){
this.$message({
message: '扣重不得大于净重',
type: 'success',
duration: 1000
})
return
}
if(buckleWeight >= grossWeight){
this.$message({
message: '扣重不得大于毛重',
type: 'success',
duration: 1000
})
return
}
this.$refs['elForm'].validate((valid) => {
if (valid) {
this.request()
this.request2()
}
})
},
request2() {
var _data = this.dataList()
if (!this.dataForm.id) {
request({
url: '/api/tradeupload/Tradeupload',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
} else {
request({
url: '/api/tradeupload/Tradeupload/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
onClose: () => {
this.visible = false
this.$emit('refresh', true)
}
})
})
}
},
request3() {
var _data = this.dataList()
if (!this.dataForm.id) {
request({
url: '/api/tradeupload/Tradeupload',
method: 'post',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
})
})
} else {
request({
url: '/api/tradeupload/Tradeupload/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
this.$message({
message: res.msg,
type: 'success',
duration: 1000,
})
})
}
this.dataForm.vehicleId = null;
this.dataForm.vehiclePictures = null;
this.dataForm.poundDate = null;
this.dataForm.poundlistNo = null;
this.dataForm.tareWeight = null;
this.dataForm.grossWeight = null;
this.dataForm.buckleWeight = null;
this.dataForm.netWeight = null;
},
request() {
var _data =this.dataList()
var _data = this.dataList()
if (!this.dataForm.id) {
request({
url: '/api/tradeupload/Tradeupload',
@ -431,9 +637,9 @@
}
})
})
}else{
} else {
request({
url: '/api/tradeupload/Tradeupload/'+this.dataForm.id,
url: '/api/tradeupload/Tradeupload/' + this.dataForm.id,
method: 'PUT',
data: _data
}).then((res) => {
@ -449,19 +655,43 @@
})
}
},
dataList(){
dataList() {
var _data = JSON.parse(JSON.stringify(this.dataForm));
_data.poundPictures = JSON.stringify(_data.poundPictures)
_data.vehiclePictures = JSON.stringify(_data.vehiclePictures)
return _data;
},
dataInfo(dataAll){
let _dataAll =dataAll
_dataAll.poundPictures = JSON.parse( _dataAll.poundPictures)
_dataAll.vehiclePictures = JSON.parse( _dataAll.vehiclePictures)
dataInfo(dataAll) {
let _dataAll = dataAll
_dataAll.poundPictures = JSON.parse(_dataAll.poundPictures)
_dataAll.vehiclePictures = JSON.parse(_dataAll.vehiclePictures)
this.dataForm = _dataAll
},
},
}
</script>
<style>
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
width: 120px;
height: 120px;
display: block;
}
</style>

@ -28,7 +28,7 @@
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<div>
<el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">
<el-button type="text" icon="el-icon-plus" @click="addOrUpdateHandle()">
</el-button>
<el-button type="text" icon="el-icon-download" @click="exportData()">
</el-button>

Loading…
Cancel
Save