业务单据功能优化

pro
郑明梁 2 years ago
parent fce6af7827
commit 6b004099d3

@ -277,6 +277,12 @@
<artifactId>jasperreports-fonts</artifactId>
<version>6.0.0</version>
</dependency>
<!-- 汉字 转 拼音/首字母-->
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>

@ -7,6 +7,8 @@ import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.AsyncDiDlHelper;
import com.glxp.api.dao.basic.BasicProductsDao;
import com.glxp.api.dao.basic.UdiProductDao;
import com.glxp.api.entity.basic.*;
import com.glxp.api.req.basic.*;
import com.glxp.api.http.sync.SpGetHttpClient;
@ -16,6 +18,11 @@ import com.glxp.api.service.basic.*;
import com.glxp.api.util.OkHttpCli;
import com.glxp.api.util.udi.FilterUdiUtils;
import lombok.extern.slf4j.Slf4j;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@ -23,6 +30,8 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
@ -43,6 +52,9 @@ public class UdiSyncController {
ProductInfoService productInfoService;
@Resource
UdiCompanyService udiCompanyService;
@Resource
BasicProductsDao basicProductsDao;
//获取同步库UDI信息
@ -183,5 +195,67 @@ public class UdiSyncController {
return ResultVOUtils.success(udiCompanyEntities);
}
@GetMapping("udiwms/test")
public void filterUdi() {
FilterUdiRelRequest filterUdiRelRequest=new FilterUdiRelRequest();
List<BasicProductsEntity> data = basicProductsDao.selectList();
int i=0;
try {
for (BasicProductsEntity datum : data) {
if(StrUtil.isNotEmpty(datum.getCpmctymc()) && StrUtil.isEmpty(datum.getPinyinInitial()) && !datum.getCpmctymc().substring(0,1).equals("α")){
i++;
String a=datum.getCpmctymc().substring(0,1);
datum.setPinyinInitial(converterToFirstSpell(datum.getCpmctymc()));
System.out.println("-----------------------------------------------------"+i);
}
}
}catch (Exception e){
System.out.println("|||||||||||||||||||||||"+e.getMessage());
}
basicProductsDao.updateBatchById(data);
}
//汉字转换位汉语拼音首字母,英文字符不变
public static String converterToFirstSpell(String chines) {
chines = cleanChar(chines);
String pinyinName = "";
char[] nameChar = chines.toCharArray();
HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
defaultFormat.setCaseType(HanyuPinyinCaseType.UPPERCASE);
defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
for (int i = 0; i < nameChar.length; i++) {
if (nameChar[i] > 128) {
try {
pinyinName += PinyinHelper.toHanyuPinyinStringArray(nameChar[i], defaultFormat)[0].charAt(0);
} catch (BadHanyuPinyinOutputFormatCombination e) {
e.printStackTrace();
}
} else {
pinyinName += nameChar[i];
}
}
return pinyinName;
}
/**
* 便
* @param chines
* @return
*/
public static String cleanChar(String chines) {
chines = chines.replaceAll("[\\p{Punct}\\p{Space}]+", ""); // 正则去掉所有字符操作
// 正则表达式去掉所有中文的特殊符号
String regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~@#¥%……&*()——+|{}<>《》【】‘;:”“’。,、?ⅢγⅣβⅡⅠ×π]";
Pattern pattern = Pattern.compile(regEx);
Matcher matcher = pattern.matcher(chines);
chines = matcher.replaceAll("").trim();
return chines;
}
}

@ -139,7 +139,7 @@ public class IoPurChangeService {
if (basicBusTypeChangeEntity.getBusBeforeTime() != null) {
purPlanEntity.setCreateTime(DateUtil.timeProcess(purApplyEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
purPlanEntity.setUpdateTime(DateUtil.timeProcess(purApplyEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
}else{
} else {
purPlanEntity.setCreateTime(purApplyEntity.getCreateTime());
purPlanEntity.setUpdateUser(purApplyEntity.getAuditUser());
}
@ -182,59 +182,66 @@ public class IoPurChangeService {
public void purPlanChange(PurPlanEntity purPlanEntity) {
BasicBusTypeChangeEntity basicBusTypeChangeEntity;
String billNos = null;
//---------------------------------判断计划为已审核就生成计划单-------------------------------------------//\
PurOrderEntity purOrderEntity = new PurOrderEntity();
if (purPlanEntity.getStatus() == 3) {
//查询计划详情
List<PurPlanDetailEntity> purPlanDetailEntityList = purPlanDetailService.findByOrderId(purPlanEntity.getId() + "");
//根据供应商分组
Map<String, List<PurPlanDetailEntity>> purPlanDetailMap = purPlanDetailEntityList.stream().collect(Collectors.groupingBy(PurPlanDetailEntity::getSupId));
basicBusTypeChangeEntity = basicBusTypeChangeService.selectByOriginAction("CGJH");
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable() == true) {
purOrderEntity.setBillNo(gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.CG_ORDER, "yyyyMMdd")));
purOrderEntity.setBillDate(purPlanEntity.getBillDate());
purOrderEntity.setStatus(basicBusTypeChangeEntity.getBusAuditStatus());
purOrderEntity.setRemark(purPlanEntity.getRemark());
purOrderEntity.setEmergency(purPlanEntity.getEmergency());
purOrderEntity.setArrivalTime(purPlanEntity.getArrivalTime());
purOrderEntity.setInvCode(purPlanEntity.getInvCode());
purOrderEntity.setDeptCode(purPlanEntity.getDeptCode());
purOrderEntity.setCreateUser(purPlanEntity.getAuditUser());
purOrderEntity.setUpdateUser(purPlanEntity.getAuditUser());
if (basicBusTypeChangeEntity.getBusBeforeTime() != null) {
purPlanEntity.setCreateTime(DateUtil.timeProcess(purOrderEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
purPlanEntity.setUpdateTime(DateUtil.timeProcess(purOrderEntity.getCreateTime(), basicBusTypeChangeEntity.getBusBeforeTime()));
}else{
purPlanEntity.setCreateTime(purOrderEntity.getCreateTime());
purPlanEntity.setUpdateUser(purOrderEntity.getAuditUser());
}
if (purOrderEntity.getStatus() == 3) {
purOrderEntity.setAuditUser("");
purOrderEntity.setAuditTime(new Date());
for (String key : purPlanDetailMap.keySet()) {
PurOrderEntity purOrderEntity = new PurOrderEntity();
List<PurPlanDetailEntity> purPlanDetailEntitys = purPlanDetailMap.get(key);
purOrderEntity.setBillNo(gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.CG_ORDER, "yyyyMMdd")));
purOrderEntity.setBillDate(purPlanEntity.getBillDate());
purOrderEntity.setSupId(key);
purOrderEntity.setStatus(basicBusTypeChangeEntity.getBusAuditStatus());
purOrderEntity.setRemark(purPlanEntity.getRemark());
purOrderEntity.setEmergency(purPlanEntity.getEmergency());
purOrderEntity.setArrivalTime(purPlanEntity.getArrivalTime());
purOrderEntity.setInvCode(purPlanEntity.getInvCode());
purOrderEntity.setDeptCode(purPlanEntity.getDeptCode());
purOrderEntity.setCreateUser(purPlanEntity.getAuditUser());
purOrderEntity.setUpdateUser(purPlanEntity.getAuditUser());
if (basicBusTypeChangeEntity.getBusBeforeTime() != null) {
purOrderEntity.setCreateTime(DateUtil.timeProcess(new Date(), basicBusTypeChangeEntity.getBusBeforeTime()));
purOrderEntity.setUpdateTime(DateUtil.timeProcess(new Date(), basicBusTypeChangeEntity.getBusBeforeTime()));
} else {
purOrderEntity.setCreateTime(new Date());
purOrderEntity.setUpdateTime(new Date());
}
if (purOrderEntity.getStatus() == 3) {
purOrderEntity.setAuditUser("");
purOrderEntity.setAuditTime(new Date());
}
//插入订单主表
purOrderService.insert(purOrderEntity);
//用stream流复制list
List<PurOrderDetailEntity> purOrderDetailEntityList = purPlanDetailEntitys.stream().map(e -> {
PurOrderDetailEntity d = new PurOrderDetailEntity();
d.setOrderIdFk(purOrderEntity.getId() + "");
d.setProductId(e.getProductId());
d.setProductName(e.getProductName());
d.setCount(e.getCount());
d.setSupId(e.getSupId());
d.setZczbhhzbapzbh(e.getZczbhhzbapzbh());
return d;
}).collect(Collectors.toList());
purOrderDetailService.insertPurOrderDetailEntity(purOrderDetailEntityList);
billNos = "," + billNos + purPlanEntity.getBillNo();
}
//插入订单主表
purOrderService.insert(purOrderEntity);
//用stream流复制list
List<PurOrderDetailEntity> purOrderDetailEntityList = purPlanDetailEntityList.stream().map(e -> {
PurOrderDetailEntity d = new PurOrderDetailEntity();
d.setOrderIdFk(purOrderEntity.getId() + "");
d.setProductId(e.getProductId());
d.setProductName(e.getProductName());
d.setCount(e.getCount());
d.setSupId(e.getSupId());
d.setZczbhhzbapzbh(e.getZczbhhzbapzbh());
return d;
}).collect(Collectors.toList());
purOrderDetailService.insertPurOrderDetailEntity(purOrderDetailEntityList);
// 更新计划表信息插入订单单号
PurPlanEntity purPlanEntity1 = new PurPlanEntity();
purPlanEntity1.setId(purPlanEntity.getId());
purPlanEntity1.setStockOrderNo(purOrderEntity.getBillNo());
purPlanEntity1.setStockOrderNo(billNos.substring(0));
// purPlanEntity.sets(true);
purPlanService.update(purPlanEntity1);
}
if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable() == true) {
purPlanGen(purPlanEntity);
}
// if (basicBusTypeChangeEntity != null && StrUtil.isNotEmpty(basicBusTypeChangeEntity.getTargetBusAction()) && basicBusTypeChangeEntity.isEnable() == true) {
// purPlanGen(purPlanEntity);
// }
}
}

@ -348,6 +348,10 @@ public class BasicProductsEntity {
@TableField(value = "remark")
private String remark;
@TableField(value = "pinyinInitial")
private String pinyinInitial;
public static final String COL_ID = "id";
public static final String COL_UUID = "uuid";

@ -35,11 +35,14 @@ public class CompanyProductRelevanceRequest extends ListPageRequest {
private String thrPiId;
private Boolean isCheck;
private Integer filterType; //0:全部1.对照完成2.未对照DI3.未对照产品编码4.未对照其他产品编码
private String customerId;
private String pinyinInitial;
private String code;
private String auditStatus;
private String companyName;

@ -111,6 +111,7 @@
ON basic_udirel.uuid = basic_products.uuid
left JOIN basic_corp on basic_corp.erpId = company_product_relevance.customerId
left join basic_hosp_type bht on basic_udirel.relCode = bht.code
left join thr_products tp on tp.code = basic_udirel.mainId
<where>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
AND ylqxzcrbarmc LIKE concat(#{ylqxzcrbarmc}, '%')
@ -184,7 +185,12 @@
<if test="filterType != null and filterType == 10">
AND basic_udirel.updateTime is NULL
</if>
<if test="pinyinInitial != null and pinyinInitial != ''">
AND basic_products.pinyinInitial like concat('%', #{pinyinInitial}, '%')
</if>
<if test="code != '' and code != null">
AND basic_udirel.mainId = #{code}
</if>
<if test="customerId != '' and customerId != null">
AND company_product_relevance.customerId = #{customerId}
</if>
@ -195,7 +201,7 @@
AND basic_udirel.id = #{id}
</if>
<if test="companyName != '' and companyName != null">
AND basic_corp.name = #{companyName}
AND basic_corp.name like concat('%', #{companyName}, '%')
</if>
<if test="lockStatus != '' and lockStatus != null">
AND basic_udirel.lockStatus = #{lockStatus}

Loading…
Cancel
Save