SELECT * FROM wms_inventory WHERE goodsID =#{goodsID}
SELECT *
FROM wms_inventory
WHERE goodsID = #{goodsID}
</select>
<selectid="otherOutGoodsListPage"
@ -658,17 +656,28 @@
SELECT * FROM
(SELECT
s.orgSidPath,
so.`name` useOrgName,
s.`name` deptName,
so.name useOrgName,
s.name deptName,
i.goodsSpuName,
i.goodsSkuCode,
i.manufacturerName,
i.supplierName,
IFNULL(SUM(`count`),0) `count`,
DATEDIFF(NOW(),(SELECT MIN(wi.firstInDate) FROM wms_inventory as wi WHERE wi.count > 0 and wi.useOrgSid = i.useOrgSid and wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid)) inventoryAge,
date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as wi on r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid and wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid and r.busTypeValue = '销售出库'),'%Y-%m-%d') salesTime,
DATEDIFF(NOW(),(date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as wi on r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid and wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid and r.busTypeValue = '销售出库'),'%Y-%m-%d'))) noSalesDays,
date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as wi on r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid and wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid and r.billType = '1'),'%Y-%m-%d') storageTime,
IFNULL(SUM(count),0) count,
DATEDIFF(NOW(),(SELECT MIN(wi.firstInDate) FROM wms_inventory as wi WHERE wi.count > 0 and wi.useOrgSid =
i.useOrgSid and wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid =
i.supplierSid)) inventoryAge,
date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as wi on
r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid and wi.goodsSkuCode = i.goodsSkuCode and
wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid and r.busTypeValue =
'销售出库'),'%Y-%m-%d') salesTime,
DATEDIFF(NOW(),(date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as
wi on r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid and wi.goodsSkuCode = i.goodsSkuCode and
wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid and r.busTypeValue =
'销售出库'),'%Y-%m-%d'))) noSalesDays,
date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as wi on
r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid and wi.goodsSkuCode = i.goodsSkuCode and
wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid and r.billType = '1'),'%Y-%m-%d')
(SELECT IFNULL(salesPrice,0) FROM yxt_base.base_goods_sku_extend as sku WHERE sku.sid = i.goodsSkuSid) price,
i.warehouseName,
@ -744,10 +749,21 @@
i.warehouseRackCode,
i.manufacturerName,
i.supplierName,
(SELECT MIN(wi.firstInDate) FROM wms_inventory as wi WHERE wi.count > 0 and wi.useOrgSid = i.useOrgSid and wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid AND wi.warehouseRackCode = i.warehouseRackCode) firstInDate,
date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as wi on r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid AND wi.warehouseRackCode = i.warehouseRackCode and wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid and r.billType = '1'),'%Y-%m-%d') storageTime, -- 最近一次入库时间
date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as wi on r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid AND wi.warehouseRackCode = i.warehouseRackCode and wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid and r.busTypeValue = '销售出库'),'%Y-%m-%d') salesTime, -- 最近一次销售日期
DATEDIFF(NOW(),date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as wi on r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid AND wi.warehouseRackCode = i.warehouseRackCode and wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid and r.billType = '1'),'%Y-%m-%d')) inventoryAge,
(SELECT MIN(wi.firstInDate) FROM wms_inventory as wi WHERE wi.count > 0 and wi.useOrgSid = i.useOrgSid and
wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid
AND wi.warehouseRackCode = i.warehouseRackCode) firstInDate,
date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as wi on
r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid AND wi.warehouseRackCode = i.warehouseRackCode and
wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid
and r.billType = '1'),'%Y-%m-%d') storageTime, -- 最近一次入库时间
date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as wi on
r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid AND wi.warehouseRackCode = i.warehouseRackCode and
wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid = i.supplierSid
and r.busTypeValue = '销售出库'),'%Y-%m-%d') salesTime, -- 最近一次销售日期
DATEDIFF(NOW(),date_format ((SELECT MAX(r.createTime) FROM wms_inventory_record as r LEFT JOIN wms_inventory as
wi on r.inventorySid = wi.sid WHERE wi.useOrgSid = i.useOrgSid AND wi.warehouseRackCode = i.warehouseRackCode
and wi.goodsSkuCode = i.goodsSkuCode and wi.manufacturerSid = i.manufacturerSid and wi.supplierSid =
i.supplierSid and r.billType = '1'),'%Y-%m-%d')) inventoryAge,
i.manufactorBillNo,
pb.payTypeValue procurementMethod,
pb.purchaseTypeValue,
@ -760,14 +776,35 @@
LEFT JOIN wms_warehouse_area as wa ON wa.sid = ra.locationSid
LEFT JOIN yxt_pms.pms_purchase_bill as pb ON pb.manufacturersOrderNumber = i.manufactorBillNo
WHERE i.count > 0
GROUP BY i.goodsID,i.goodsSkuSid,i.goodsSkuCode,i.useOrgSid,i.manufacturerSid,i.supplierSid,i.warehouseRackCode,i.manufactorBillNo) m