Merge remote-tracking branch 'origin/dev' into dev

yun-zuoyi
crish 6 years ago
commit be63f4eab9

@ -215,7 +215,7 @@ public interface BaseRepository <T, ID extends Serializable> extends JpaReposito
List<T> findByProperty(String propertyName, Object value);
List<Map<String,Object>> findByWasProperty(String[] propertyNames, Object[] values);
List<T> findByProperty(String[] propertyNames, Object[] values);

@ -411,44 +411,11 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
}
return query.setFirstResult(offset).setMaxResults(pageSize).getResultList();
}
@Override
public List<T> findByProperty(String propertyName, Object value) {
String queryString = "from " + persistentClass.getSimpleName() + " as model where model." + propertyName + "= :" + propertyName;
return entityManager.createQuery(queryString).setParameter(propertyName, value).getResultList();
}
@Override
public List<Map<String,Object>> findByWasProperty(String[] propertyNames, Object[] values) {
if (propertyNames.length != values.length) {
throw new IllegalArgumentException("参数名的数量和参数值不匹配!propertyNames:" + propertyNames.length + ",values:" + values.length);
}
StringBuffer queryString = new StringBuffer();
queryString.append(" SELECT \n" +
" a.sn_status AS snStatus,\n" +
" a.wh_no AS whNo,\n" +
" a.locate_no AS locateNo,\n" +
" a.part_no AS partNo,\n" +
" a.part_name_rdd AS partNameRdd,\n" +
" a.lot_no AS lotNo,\n" +
" CAST(IFNULL(SUM(a.qty), 0) AS DOUBLE) AS qty \n" +
"FROM\n" +
" `wms_stock_sn` a ");
int size = propertyNames.length;
if (size > 0) {
queryString.append("where 1=1 and a.sn_status in ('"+ WmsEnumUtil.STOCK_SN_STATUS.PRE_INSTOCK.getValue()+"', '"+WmsEnumUtil.STOCK_SN_STATUS.INSTOCKED.getValue()+"','"+WmsEnumUtil.STOCK_SN_STATUS.PICKED.getValue()+"','"+WmsEnumUtil.STOCK_SN_STATUS.QUALITY_CONTROL.getValue()+"') ");
}
for (int i = 0; i < size; i++) {
if (values[i] != null) {
queryString.append(" and a." + StringCastUtils.upperCharToUnderLine(propertyNames[i]) + "= '" + values[i]+"'");
}
}
queryString.append(" group by a.lot_no,a.date_code");
return entityManager.createNativeQuery(queryString.toString()).unwrap(SQLQuery.class).setResultTransformer(
Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
}
@Override
public List<T> findByProperty(String[] propertyNames, Object[] values) {
if(propertyNames.length != values.length){
@ -1583,6 +1550,4 @@ public class BaseRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRep
}
return num;
}
}

@ -7,30 +7,21 @@ import java.util.regex.Pattern;
* 线
*/
public class StringCastUtils {
public static String upperCharToUnderLine(String param) {
Pattern p= Pattern.compile("[A-Z]");
if(param==null ||param.equals("")){
return "";
}
StringBuilder builder=new StringBuilder(param);
Matcher mc=p.matcher(param);
int i=0;
while (mc.find()) {
System.out.println(builder.toString());
System.out.println("mc.start():" + mc.start() + ", i: " + i);
System.out.println("mc.end():" + mc.start() + ", i: " + i);
builder.replace(mc.start()+i, mc.end()+i, "_"+mc.group().toLowerCase());
i++;
Pattern p= Pattern.compile("[A-Z]");
if(param==null ||param.equals("")){
return "";
}
StringBuilder builder=new StringBuilder(param);
Matcher mc=p.matcher(param);
int i=0;
while (mc.find()) {
builder.replace(mc.start()+i, mc.end()+i, "_"+mc.group().toLowerCase());
i++;
}
if('_' == builder.charAt(0)){
builder.deleteCharAt(0);
}
System.out.println(builder.toString());
return builder.toString();
}
// public static void main(String[] args) {
// upperCharToUnderLine("snStatus");
// }
}

@ -31,8 +31,8 @@ public class MesEquipmentModel implements Serializable {
@ApiParam(value ="设备工位关联ID")
private Long wcId;
@ApiParam(value ="设备代码&工位")
private String equipmentCodeAndworkCellCode;
@ApiParam(value ="设备&工位")
private String equipmentNameAndworkCellName;
public MesEquipmentModel() {
@ -49,22 +49,13 @@ public class MesEquipmentModel implements Serializable {
this.areaCode = areaCode;
}
public MesEquipmentModel(Long wcId, Long id, String equipmentCode, String equipmentName, Integer status, String workCenterCode, String workCellCode) {
this.wcId = wcId;
this.id = id;
this.equipmentCode = equipmentCode;
this.equipmentName = equipmentName;
this.status = status;
this.workCenterCode = workCenterCode;
this.workCellCode = workCellCode;
}
public MesEquipmentModel(Long id, String equipmentCodeAndworkCellCode, String equipmentCode, String equipmentName, Integer status, String workCenterCode, String workCellCode) {
public MesEquipmentModel(Long id, String equipmentNameAndworkCellName, String equipmentCode, String equipmentName, Integer status, String areaCode, String workCenterCode, String workCellCode) {
this.id = id;
this.equipmentCodeAndworkCellCode = equipmentCodeAndworkCellCode;
this.equipmentNameAndworkCellName = equipmentNameAndworkCellName;
this.equipmentCode = equipmentCode;
this.equipmentName = equipmentName;
this.status = status;
this.areaCode = areaCode;
this.workCenterCode = workCenterCode;
this.workCellCode = workCellCode;

@ -1,79 +1,42 @@
package cn.estsh.i3plus.pojo.wms.bean.iotio;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import java.io.Serializable;
@Data
public class WmsCSOrderDetailsModel implements Serializable {
/******
*
*
*/
@ApiParam("工厂代码")
public String organizeCode;
/******
*
*
*/
@ApiParam("库位编码")
public String locateNo;
/******
*
*
*/
@ApiParam("订单编号")
public String orderNo;
/******
*
*
*/
@ApiParam("物料代码")
public String partNo;
/******
*
*
*/
@ApiParam("物料名称")
public String partNameRdd;
/******
*
*
*/
@ApiParam("冻结数量")
public String qty;
/******
*
*
*/
@ApiParam("实盘数量")
public String factQty;
/******
*
*
*/
@ApiParam("条码编号")
public String sn;
/******
*
*
*/
@ApiParam("仓库编码")
public String whNo;
/******
*
*
*/
@ApiParam("区域编码")
public String zoneNo;
/******
*
*
*/
@ApiParam("状态")
public String wmStatus;
}

Loading…
Cancel
Save