12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- SELECT
- 0 as mr,
- CONCAT('uploads/thumbnail/',ep.`picpath`,'/',ep.`newpicname`) picpath,
- CONCAT('uploads/image/',ep.`picpath`,'/',ep.`newpicname`) srcpath,
- pr.partId id,
- pr.id prid,
- c.id contractId,c.bigId,pr.pastureId,c.pastureName,pr.partId,pr.partName,pr.partCode,pr.specification,
- TRIM(TRAILING'.' FROM (TRIM(TRAILING'0' FROM pr.price))) price,pr.brandId,pr.brand,c.inventoryType,
- c.planAmount,c.remark,c.enable,pr.unit,c.isZeroStock,
- trim(pr.`reportery`) reportery,
- pv.providerName,
- pv.id providerId,
- pr.locationId,
- pr.id partRepId
- FROM
- part_repertory pr
- LEFT JOIN contract c
- ON c.`id` = pr.`contractId`
- LEFT JOIN bigcontract bc
- ON bc.`id` = c.`bigId`
- LEFT JOIN provider pv
- ON pv.`id` = pr.`providerId`
- LEFT JOIN parts ps
- ON ps.id = pr.partId
- LEFT JOIN eq_pic ep
- ON ep.id = ps.picpath
- left join warehouse w
- on w.id = pr.locationId
- WHERE
- (pr.pastureId =31 or (pr.pastureId =18 and (select pastureId from warehouse where id = pr.`locationId`)= 31) )
- and
- (
- (
- (
- (bc.`stopTime`>=DATE_FORMAT(NOW(),'%Y-%m-%d') and bc.statue=1 AND c.`enable`=1 )
- or bc.isZeroStock=0 )
- and bc.SHStatus = 7)
- or pr.`contractId` <0
- )
- and (pr.reportery>0 or(bc.`stopTime`>=DATE_FORMAT(NOW(),'%Y-%m-%d') and bc.statue=1))
- -- and ps.enable = 1
- and (pr.`partCode` LIKE CONCAT('%','14.02.03.02.000013','%')
- )
-
|