Commit 085003ee by yyq1988

Merge remote-tracking branch 'origin/master'

parents fd6b8037 35491488
...@@ -21,5 +21,6 @@ public interface LedgerInfoMapper extends BaseMapper<LedgerInfo> { ...@@ -21,5 +21,6 @@ public interface LedgerInfoMapper extends BaseMapper<LedgerInfo> {
public List<CountLedgerInfo> findCliList(LedgerInfo ledgerInfo); public List<CountLedgerInfo> findCliList(LedgerInfo ledgerInfo);
void deleteByLedgerInfo(@Param("id") String id); void deleteByLedgerInfo(@Param("id") String id);
public List<LedgerInfo> findListByQrIdAndCode(LedgerInfo ledgerInfo);
void updateByLedgerInfo(@Param("id") String id); void updateByLedgerInfo(@Param("id") String id);
} }
\ No newline at end of file
...@@ -252,4 +252,29 @@ ...@@ -252,4 +252,29 @@
</where> </where>
GROUP BY a.ledger_id,a.batch_num,a.shelves_id GROUP BY a.ledger_id,a.batch_num,a.shelves_id
</select> </select>
<select id="findListByQrIdAndCode" resultType="LedgerInfo" >
SELECT
<include refid="ledgerInfoColumns"/>
FROM t_wh_ledger_info a
<include refid="ledgerInfoJoins"/>
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
${dataScope}
<if test="code != null and code != ''">
AND a.code = #{code}
</if>
<if test="qr != null and qr.id != null and qr.id != ''">
AND a.qr_id = #{qr.id}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.create_date ASC
</otherwise>
</choose>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -66,28 +66,31 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> { ...@@ -66,28 +66,31 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
List<CountLedgerInfo> list = entry.getValue(); List<CountLedgerInfo> list = entry.getValue();
CountLedgerInfo cli = new CountLedgerInfo(); CountLedgerInfo cli = new CountLedgerInfo();
Set<String> wNameSet = new HashSet<>(); Set<String> wNameSet = new HashSet<>();
Set<String> sNameSet = new HashSet<>();
String shelvesNames = ""; String shelvesNames = "";
int num = 0; int num = 0;
BigDecimal sum = new BigDecimal(0); BigDecimal sum = new BigDecimal(0);
for (int i = 0; i < list.size(); i ++) { for (int i = 0; i < list.size(); i ++) {
CountLedgerInfo c = list.get(0); CountLedgerInfo c = list.get(i);
if (i == 0) { if (i == 0) {
cli.setBatchNum(c.getBatchNum()); cli.setBatchNum(c.getBatchNum());
cli.setModel(c.getModel()); cli.setModel(c.getModel());
cli.setName(c.getName()); cli.setName(c.getName());
cli.setType(c.getType()); cli.setType(c.getType());
} }
if (i != list.size() - 1) { sNameSet.add(c.getShelves().getName());
/*if (i != list.size() - 1) {
shelvesNames = shelvesNames + c.getShelves().getName() + ","; shelvesNames = shelvesNames + c.getShelves().getName() + ",";
} else { } else {
shelvesNames = shelvesNames + c.getShelves().getName(); shelvesNames = shelvesNames + c.getShelves().getName();
} }*/
wNameSet.add(c.getShelves().getWarehouse().getName()); wNameSet.add(c.getShelves().getWarehouse().getName());
num += c.getNum(); num += c.getNum();
sum = sum.add(c.getSum()); sum = sum.add(c.getSum());
} }
String wNames = ShelvesUtil.mergerWarehouseName(wNameSet); String wNames = ShelvesUtil.mergerWarehouseName(wNameSet);
cli.setShelvesNames(shelvesNames); String sNames = ShelvesUtil.mergerWarehouseName(sNameSet);
cli.setShelvesNames(sNames);
cli.setWarehouseNames(wNames); cli.setWarehouseNames(wNames);
cli.setNum(num); cli.setNum(num);
cli.setSum(sum); cli.setSum(sum);
...@@ -205,7 +208,7 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> { ...@@ -205,7 +208,7 @@ public class LedgerService extends CrudService<LedgerMapper, Ledger> {
} }
@Transactional(readOnly = false) @Transactional(readOnly = false)
public LedgerInfo findByQrOrCode(LedgerInfo ledgerInfo) { public LedgerInfo findByQrOrCode(LedgerInfo ledgerInfo) {
List<LedgerInfo> ledgerInfoList = ledgerInfoMapper.findList(ledgerInfo); List<LedgerInfo> ledgerInfoList = ledgerInfoMapper.findListByQrIdAndCode(ledgerInfo);
if (null != ledgerInfoList && ledgerInfoList.size() > 0) { if (null != ledgerInfoList && ledgerInfoList.size() > 0) {
return ledgerInfoList.get(0); return ledgerInfoList.get(0);
} else { } else {
......
...@@ -35,14 +35,14 @@ public class MaterialTypeService extends TreeService<MaterialTypeMapper, Materia ...@@ -35,14 +35,14 @@ public class MaterialTypeService extends TreeService<MaterialTypeMapper, Materia
@Transactional(readOnly = false) @Transactional(readOnly = false)
public void save(MaterialType materialType) { public void save(MaterialType materialType) {
String [] parentIdsArr = materialType.getParentIds().split(","); if (null != materialType.getParentIds()) {
if (parentIdsArr.length >= 2) { String [] parentIdsArr = materialType.getParentIds().split(",");
materialType.setLast(1); if (parentIdsArr.length >= 2) {
} else { materialType.setLast(1);
materialType.setLast(0); } else {
materialType.setLast(0);
}
} }
super.save(materialType); super.save(materialType);
} }
......
...@@ -28,10 +28,12 @@ public class ShelvesUtil { ...@@ -28,10 +28,12 @@ public class ShelvesUtil {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (int i =0; i < wList.size(); i ++) { for (int i =0; i < wList.size(); i ++) {
if (0 != wList.size()) { if (0 != wList.size()) {
sb.append(wList.get(0)); sb.append(wList.get(i));
sb.append(","); if (i != wList.size() - 1) {
sb.append(",");
}
} else { } else {
sb.append(wList.get(0)); sb.append(wList.get(i));
} }
} }
return sb.toString(); return sb.toString();
......
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
s.name AS "shelves.name", s.name AS "shelves.name",
warehouse.name AS "warehouse.name", warehouse.name AS "warehouse.name",
qr.code AS "qrCode.code" qr.code AS "qrCode.code",
qr.state AS "qrCode.state"
</sql> </sql>
<sql id="storageInfoJoins"> <sql id="storageInfoJoins">
...@@ -56,6 +57,9 @@ ...@@ -56,6 +57,9 @@
<if test="storage != null and storage.id != null and storage.id != ''"> <if test="storage != null and storage.id != null and storage.id != ''">
AND a.storage_id = #{storage.id} AND a.storage_id = #{storage.id}
</if> </if>
<if test="goodsInfo != null and goodsInfo.id != null and goodsInfo.id != ''">
AND a.goods_info_id = #{goodsInfo.id}
</if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
AND a.name LIKE AND a.name LIKE
<if test="dbName == 'oracle'">'%'||#{name}||'%'</if> <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
...@@ -65,12 +69,12 @@ ...@@ -65,12 +69,12 @@
<if test="type != null and type.id != null and type.id != ''"> <if test="type != null and type.id != null and type.id != ''">
AND a.type_id = #{type.id} AND a.type_id = #{type.id}
</if> </if>
<if test="shelves != null and shelves.id != null and shelves.id != ''"> <if test="shelves != null and shelves.id != null and shelves.id != ''">
AND a.shelves_id = #{shelves.id} AND a.shelves_id = #{shelves.id}
</if> </if>
<if test="goodsInfo != null and goodsInfo.id != null and goodsInfo.id != ''">
AND a.goods_info_id = #{goodsInfo.id}
</if>
<if test="model != null and model != ''"> <if test="model != null and model != ''">
AND a.model LIKE AND a.model LIKE
<if test="dbName == 'oracle'">'%'||#{model}||'%'</if> <if test="dbName == 'oracle'">'%'||#{model}||'%'</if>
......
...@@ -79,11 +79,12 @@ public class StorageService extends CrudService<StorageMapper, Storage> { ...@@ -79,11 +79,12 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
List<CountStorageInfo> list = entry.getValue(); List<CountStorageInfo> list = entry.getValue();
CountStorageInfo csi = new CountStorageInfo(); CountStorageInfo csi = new CountStorageInfo();
Set<String> wNameSet = new HashSet<>(); Set<String> wNameSet = new HashSet<>();
Set<String> sNameSet = new HashSet<>();
String shelvesNames = ""; String shelvesNames = "";
int num = 0; int num = 0;
BigDecimal sum = new BigDecimal(0); BigDecimal sum = new BigDecimal(0);
for (int i = 0; i < list.size(); i ++) { for (int i = 0; i < list.size(); i ++) {
CountStorageInfo c = list.get(0); CountStorageInfo c = list.get(i);
if (i == 0) { if (i == 0) {
csi.setGoodsInfo(c.getGoodsInfo()); csi.setGoodsInfo(c.getGoodsInfo());
csi.setModel(c.getModel()); csi.setModel(c.getModel());
...@@ -92,17 +93,19 @@ public class StorageService extends CrudService<StorageMapper, Storage> { ...@@ -92,17 +93,19 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
csi.setState(c.getState()); csi.setState(c.getState());
csi.setAmount(c.getAmount()); csi.setAmount(c.getAmount());
} }
if (i != list.size() - 1) { sNameSet.add(c.getShelves().getName());
/*if (i != list.size() - 1) {
shelvesNames = shelvesNames + c.getShelves().getName() + ","; shelvesNames = shelvesNames + c.getShelves().getName() + ",";
} else { } else {
shelvesNames = shelvesNames + c.getShelves().getName(); shelvesNames = shelvesNames + c.getShelves().getName();
} }*/
wNameSet.add(c.getWarehouse().getName()); wNameSet.add(c.getWarehouse().getName());
num += c.getNum(); num += c.getNum();
sum = sum.add(c.getSum()); sum = sum.add(c.getSum());
} }
String wNames = ShelvesUtil.mergerWarehouseName(wNameSet); String wNames = ShelvesUtil.mergerWarehouseName(wNameSet);
csi.setShelvesNames(shelvesNames); String sNames = ShelvesUtil.mergerWarehouseName(sNameSet);
csi.setShelvesNames(sNames);
csi.setWarehouseNames(wNames); csi.setWarehouseNames(wNames);
csi.setNum(num); csi.setNum(num);
csi.setSum(sum); csi.setSum(sum);
...@@ -120,6 +123,7 @@ public class StorageService extends CrudService<StorageMapper, Storage> { ...@@ -120,6 +123,7 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
*/ */
public List<StorageInfo> findInfoBycountStorage(CountStorageInfo countStorageInfo) { public List<StorageInfo> findInfoBycountStorage(CountStorageInfo countStorageInfo) {
StorageInfo storageInfo = new StorageInfo(); StorageInfo storageInfo = new StorageInfo();
storageInfo.setStorage(countStorageInfo.getStorage());
storageInfo.setShelves(countStorageInfo.getShelves()); storageInfo.setShelves(countStorageInfo.getShelves());
storageInfo.setGoodsInfo(countStorageInfo.getGoodsInfo()); storageInfo.setGoodsInfo(countStorageInfo.getGoodsInfo());
storageInfo.setPage(countStorageInfo.getPage()); storageInfo.setPage(countStorageInfo.getPage());
...@@ -144,6 +148,7 @@ public class StorageService extends CrudService<StorageMapper, Storage> { ...@@ -144,6 +148,7 @@ public class StorageService extends CrudService<StorageMapper, Storage> {
continue; continue;
} }
GoodsInfo goodsInfo = storageInfo.getGoodsInfo(); GoodsInfo goodsInfo = storageInfo.getGoodsInfo();
goodsInfo = goodsInfoMapper.get(goodsInfo.getId());
if (StorageInfo.DEL_FLAG_NORMAL.equals(storageInfo.getDelFlag())){ if (StorageInfo.DEL_FLAG_NORMAL.equals(storageInfo.getDelFlag())){
if (StringUtils.isBlank(storageInfo.getId())){ if (StringUtils.isBlank(storageInfo.getId())){
storageInfo.setStorage(storage); storageInfo.setStorage(storage);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment