| | |
| | | |
| | | namespace Home\DAO; |
| | | |
| | | use think\Log; |
| | | use Home\Common\FIdConst; |
| | | |
| | | /** |
| | |
| | | $queryParams = array(); |
| | | |
| | | $result = array(); |
| | | $sql = "SELECT |
| | | |
| | | $sql = "select |
| | | st.id sobill_tacking_id, |
| | | s.id sobill_id, |
| | | sd.id sobill_detail_id, |
| | | date_format( s.deal_date, '%Y-%m-%d' ) sobill_deal_date, |
| | | date_format(s.deal_date, '%%Y-%%m-%%d') sobill_deal_date, |
| | | wb.id wsbill_id, |
| | | wbd.id wsbill_detail_id, |
| | | sd.goods_id goods_id, |
| | | s.customer_id customer_id, |
| | | c.name customer_name, |
| | | c. NAME customer_name, |
| | | sb.ref scbill_no, |
| | | s.ref sobill_no, |
| | | g.name good_name, |
| | | sd.goods_count goods_count, |
| | | gu.name unit_name, |
| | | g. NAME good_name, |
| | | 0+cast(sd.goods_count as char) goods_count, |
| | | gu. NAME unit_name, |
| | | wb.ref wsbill_no, |
| | | date_format( wb.bizdt, '%Y-%m-%d' ) wsbill_biz_dt, |
| | | wbd.goods_count ws_goods_count, |
| | | date_format(wb.bizdt, '%%Y-%%m-%%d') wsbill_biz_dt, |
| | | 0+cast(wbd.goods_count as char) ws_goods_count, |
| | | st.declare_no, |
| | | date_format( st.declare_time, '%Y-%m-%d' ) declare_time, |
| | | u1.name declare_user_name, |
| | | date_format( st.quarantine_time, '%Y-%m-%d' ) quarantine_time, |
| | | u2.name quarantine_user_name, |
| | | date_format( st.check_time, '%Y-%m-%d' ) check_time, |
| | | u3.name check_user_name, |
| | | date_format( st.release_time, '%Y-%m-%d' ) release_time, |
| | | u4.name release_user_name, |
| | | date_format( st.pick_up_time, '%Y-%m-%d' ) pick_up_time, |
| | | u5.name pick_up_user_name, |
| | | date_format( st.unload_time, '%Y-%m-%d' ) unload_time, |
| | | u6.name unload_user_name, |
| | | st.memo |
| | | date_format(st.declare_time, '%%Y-%%m-%%d') declare_time, |
| | | u1. NAME declare_user_name, |
| | | date_format( |
| | | st.quarantine_time, |
| | | '%%Y-%%m-%%d' |
| | | ) quarantine_time, |
| | | u2. NAME quarantine_user_name, |
| | | date_format(st.check_time, '%%Y-%%m-%%d') check_time, |
| | | u3. NAME check_user_name, |
| | | date_format(st.release_time, '%%Y-%%m-%%d') release_time, |
| | | u4. NAME release_user_name, |
| | | date_format(st.pick_up_time, '%%Y-%%m-%%d') pick_up_time, |
| | | u5. NAME pick_up_user_name, |
| | | date_format(st.unload_time, '%%Y-%%m-%%d') unload_time, |
| | | u6. NAME unload_user_name, |
| | | st.memo |
| | | FROM |
| | | t_so_bill s |
| | | INNER JOIN t_so_bill_detail sd ON s.id = sd.sobill_id |
| | |
| | | LEFT JOIN t_user u5 ON u5.id = st.pick_up_user_id |
| | | LEFT JOIN t_user u6 ON u6.id = st.unload_user_id |
| | | WHERE |
| | | 1 = 1 "; |
| | | |
| | | 1 = 1 "; |
| | | $ds = new DataOrgDAO($db); |
| | | $rs = $ds->buildSQL(FIdConst::SO_BILL_TRACKING, "s", $loginUserId); |
| | | if ($rs) { |
| | |
| | | } |
| | | |
| | | if ($scbillNo) { |
| | | $sql .= " and (sb.ref like '%s%') "; |
| | | $sql .= " and (sb.ref like '%s') "; |
| | | $queryParams[] = "%$scbillNo%"; |
| | | } |
| | | if ($sobillNo) { |
| | | $sql .= " and (s.ref like '%s%') "; |
| | | $sql .= " and (s.ref like '%s') "; |
| | | $queryParams[] = "%$sobillNo%"; |
| | | } |
| | | |
| | |
| | | limit %d , %d"; |
| | | $queryParams[] = $start; |
| | | $queryParams[] = $limit; |
| | | Log::write("==SQL==:".$sql,"DEBUG"); |
| | | $data = $db->query($sql, $queryParams); |
| | | foreach ($data as $i => $v) { |
| | | $result[$i]["sobill_tacking_id"] = $v["sobill_tacking_id"]; |
| | | $result[$i]["sobill_id"] = $v["sobill_id"]; |
| | | $result[$i]["sobill_detail_id"] = $v["sobill_detail_id"]; |
| | | $result[$i]["deal_date"] = $v["deal_date"]; |
| | | $result[$i]["sobill_deal_date"] = $v["sobill_deal_date"]; |
| | | $result[$i]["wsbill_id"] = $v["wsbill_id"]; |
| | | $result[$i]["wsbill_detail_id"] = $v["wsbill_detail_id"]; |
| | | $result[$i]["goods_id"] = $v["goods_id"]; |
| | |
| | | } |
| | | |
| | | if ($scbillNo) { |
| | | $sql .= " and (sb.ref like '%s%') "; |
| | | $sql .= " and (sb.ref like '%s') "; |
| | | $queryParams[] = "%$scbillNo%"; |
| | | } |
| | | if ($sobillNo) { |
| | | $sql .= " and (s.ref like '%s%') "; |
| | | $sql .= " and (s.ref like '%s') "; |
| | | $queryParams[] = "%$sobillNo%"; |
| | | } |
| | | |