123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652 |
- package controllers
-
- import (
- "XT_New/enums"
- "XT_New/models"
- "XT_New/service"
- "XT_New/utils"
- "encoding/json"
- "fmt"
- "github.com/astaxie/beego"
- "reflect"
- "strconv"
- "strings"
- "time"
- )
-
- type SupplyOrderApiController struct {
- BaseAuthAPIController
- }
-
- func SupplyOrderApiRegistRouters() {
-
- beego.Router("/api/supply/getinitorder", &SupplyOrderApiController{}, "get:GetInitOrder")
- beego.Router("/api/supply/savepurchaseorder", &SupplyOrderApiController{}, "post:SavePurchaseOrder")
- beego.Router("/api/supply/getallsupply", &SupplyOrderApiController{}, "get:GetAllSupply")
- beego.Router("/api/supply/getallpurchaseorderlist", &SupplyOrderApiController{}, "get:GetAllPurchaseOrderList")
- beego.Router("/api/supply/updatepurchaseorder", &SupplyOrderApiController{}, "Post:UpdatePurchaseOrder")
- beego.Router("/api/supply/checkpurchaseorder", &SupplyOrderApiController{}, "get:UpdateSupplyWaresing")
- beego.Router("/api/supply/getpurchaseorderdetail", &SupplyOrderApiController{}, "get:GetPurchaseOrderDetail")
- beego.Router("/api/supply/addgoodorder", &SupplyOrderApiController{}, "post:AddGoodOrder")
- }
-
- func (this *SupplyOrderApiController) GetInitOrder() {
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
- //获取药品库数据
- baseList, _ := service.GetSupplyDrugList(orgId)
-
- goodList, _ := service.GetSupplyGoodList(orgId)
-
- manufactuerList, _ := service.GetAllManufacturerList(orgId)
-
- goodTypeList, _ := service.GetAllGoodType(orgId)
-
- supplyList, _ := service.GetSupplierList(orgId)
-
- var drugType = "药品类型"
- drugTypeParent, _ := service.GetDrugDataConfig(0, drugType)
- drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
- this.ServeSuccessJSON(map[string]interface{}{
- "drugList": baseList,
- "goodList": goodList,
- "manufactuerList": manufactuerList,
- "goodTypeList": goodTypeList,
- "drugTypeList": drugTypeList,
- "supplyList": supplyList,
- })
- return
- }
-
- func (this *SupplyOrderApiController) SavePurchaseOrder() {
-
- supplier_id, _ := this.GetInt64("supplier_name")
- start_time := this.GetString("start_time")
- end_time := this.GetString("end_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var startTime int64
- if len(start_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- startTime = theTime.Unix()
- }
- var endTime int64
- if len(end_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- endTime = theTime.Unix()
- }
-
- rate_of_concession := this.GetString("rate_of_concession")
- rate_of_concession_float, _ := strconv.ParseFloat(rate_of_concession, 64)
- discount_amount := this.GetString("discount_amount")
- discount_amount_float, _ := strconv.ParseFloat(discount_amount, 64)
- fmt.Println("supplier_id23323232323232", supplier_id, startTime, endTime, rate_of_concession, rate_of_concession_float, discount_amount, discount_amount_float)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- //生成订货单
- timeStr := time.Now().Format("2006-01-02")
- timeArr := strings.Split(timeStr, "-")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- total, _ := service.FindAllSupplyOrder(orgId)
- total = total + 1
- warehousing_order := "CGDD" + timeArr[0] + timeArr[1] + timeArr[2] + "00" + strconv.FormatInt(total, 10)
- recordDateStr := time.Now().Format("2006-01-02")
- recordDate, parseDateErr := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
- fmt.Scan("parseDateErr", parseDateErr)
- record_date := recordDate.Unix()
- info := models.SupplierWarehouseInfo{
- Number: warehousing_order,
- UserOrgId: orgId,
- Creater: this.GetAdminUserInfo().AdminUser.Id,
- Ctime: time.Now().Unix(),
- Mtime: 0,
- Status: 1,
- RecordDate: record_date,
- IsCheck: 2,
- RateOfConcession: rate_of_concession_float,
- DiscountAmount: discount_amount_float,
- DocumentDate: startTime,
- DeliveryDate: endTime,
- SupplierId: supplier_id,
- }
- err = service.CreateSupplyWarehouse(info)
- warehouseInfo, _ := service.FindLastSupplyWarehouseInfo(orgId)
- var warehousingInfo []*models.SupplierWarehousingInfoOrder
- if dataBody["stockIn"] != nil && reflect.TypeOf(dataBody["stockIn"]).String() == "[]interface {}" {
- thisStockIn, _ := dataBody["stockIn"].([]interface{})
- if len(thisStockIn) > 0 {
- for _, item := range thisStockIn {
- items := item.(map[string]interface{})
-
- if items["project_id"] == nil || reflect.TypeOf(items["project_id"]).String() != "float64" {
- utils.ErrorLog("project_id")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- project_id := int64(items["project_id"].(float64))
-
- if items["supply_count"] == nil || reflect.TypeOf(items["supply_count"]).String() != "float64" {
- utils.ErrorLog("supply_count")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- supply_count := int64(items["supply_count"].(float64))
-
- if items["supply_license_number"] == nil || reflect.TypeOf(items["supply_license_number"]).String() != "string" {
- utils.ErrorLog("supply_license_number")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_license_number := items["supply_license_number"].(string)
-
- if items["supply_price"] == nil || reflect.TypeOf(items["supply_price"]).String() != "string" {
- utils.ErrorLog("supply_price")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- supply_price := items["supply_price"].(string)
-
- supply_price_float, _ := strconv.ParseFloat(supply_price, 64)
-
- if items["supply_remake"] == nil || reflect.TypeOf(items["supply_remake"]).String() != "string" {
- utils.ErrorLog("supply_remake")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_remake := items["supply_remake"].(string)
-
- if items["supply_total_price"] == nil || reflect.TypeOf(items["supply_total_price"]).String() != "string" {
- utils.ErrorLog("supply_total_price")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- supply_total_price := items["supply_total_price"].(string)
-
- supply_total_price_float, _ := strconv.ParseFloat(supply_total_price, 64)
- if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
- utils.ErrorLog("type")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- is_source := int64(items["type"].(float64))
-
- if items["supply_type"] == nil || reflect.TypeOf(items["supply_type"]).String() != "string" {
- utils.ErrorLog("supply_type")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_type := items["supply_type"].(string)
-
- if items["supply_specification_name"] == nil || reflect.TypeOf(items["supply_specification_name"]).String() != "string" {
- utils.ErrorLog("supply_specification_name")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_specification_name := items["supply_specification_name"].(string)
-
- if items["supply_total"] == nil || reflect.TypeOf(items["supply_total"]).String() != "string" {
- utils.ErrorLog("supply_total")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_total := items["supply_total"].(string)
-
- if items["supply_manufacturer"] == nil || reflect.TypeOf(items["supply_manufacturer"]).String() != "string" {
- utils.ErrorLog("supply_manufacturer")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_manufacturer := items["supply_manufacturer"].(string)
-
- if items["name"] == nil || reflect.TypeOf(items["name"]).String() != "string" {
- utils.ErrorLog("name")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- name := items["name"].(string)
-
- if items["supply_unit"] == nil || reflect.TypeOf(items["supply_unit"]).String() != "string" {
- utils.ErrorLog("supply_unit")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_unit := items["supply_unit"].(string)
-
- order := models.SupplierWarehousingInfoOrder{
- OrderNumber: warehousing_order,
- IsSource: is_source,
- Count: supply_count,
- Price: supply_price_float,
- Amount: supply_total_price_float,
- Remark: supply_remake,
- UserOrgId: orgId,
- Ctime: time.Now().Unix(),
- Status: 1,
- Mtime: 0,
- WarehousingId: warehouseInfo.ID,
- ProjectId: project_id,
- SupplyLicenseNumber: supply_license_number,
- SupplyType: supply_type,
- SupplySpecificationName: supply_specification_name,
- SupplyTotal: supply_total,
- SupplyManufacturer: supply_manufacturer,
- Name: name,
- SupplyUnit: supply_unit,
- }
-
- warehousingInfo = append(warehousingInfo, &order)
- }
- }
- }
-
- for _, item := range warehousingInfo {
- err = service.CreateSupplyWarehousingOrder(item)
- }
-
- //查询
- orderInfo, err := service.GetSupplyWarehousingOrderInfo(warehouseInfo.ID)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "order": warehousingInfo,
- "warehouseInfo": warehouseInfo,
- "orderInfo": orderInfo,
- })
- } else {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (this *SupplyOrderApiController) GetAllSupply() {
-
- orgId := this.GetAdminUserInfo().CurrentOrgId
- appId := this.GetAdminUserInfo().CurrentAppId
- supplyList, err := service.GetSupplierList(orgId)
- doctorList, err := service.GetAllDoctor(orgId, appId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "supplyList": supplyList,
- "doctorList": doctorList,
- })
- } else {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (this *SupplyOrderApiController) GetAllPurchaseOrderList() {
-
- check_id, _ := this.GetInt64("check_id")
- start_time := this.GetString("start_time")
- end_time := this.GetString("end_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var startTime int64
- if len(start_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- startTime = theTime.Unix()
- }
- var endTime int64
- if len(end_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- endTime = theTime.Unix()
- }
- keyword := this.GetString("keyword")
-
- page, _ := this.GetInt64("page")
-
- limit, _ := this.GetInt64("limit")
- orgId := this.GetAdminUserInfo().CurrentOrgId
- list, total, err := service.GetAllPurchaseOrderList(check_id, startTime, endTime, keyword, page, limit, orgId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "list": list,
- "total": total,
- })
- } else {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (this *SupplyOrderApiController) UpdatePurchaseOrder() {
- supplier_id, _ := this.GetInt64("supplier_name")
- start_time := this.GetString("start_time")
- end_time := this.GetString("end_time")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var startTime int64
- if len(start_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- startTime = theTime.Unix()
- }
- var endTime int64
- if len(end_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time+" 23:59:59", loc)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- endTime = theTime.Unix()
- }
-
- rate_of_concession := this.GetString("rate_of_concession")
- rate_of_concession_float, _ := strconv.ParseFloat(rate_of_concession, 64)
- discount_amount := this.GetString("discount_amount")
- discount_amount_float, _ := strconv.ParseFloat(discount_amount, 64)
- warehousing_id, _ := this.GetInt64("id")
- number := this.GetString("number")
- //fmt.Println("supplier_id23323232323232", supplier_id, startTime, endTime, rate_of_concession, rate_of_concession_float, discount_amount, discount_amount_float)
- orgId := this.GetAdminUserInfo().CurrentOrgId
- info := models.SupplierWarehouseInfo{
- RateOfConcession: rate_of_concession_float,
- DiscountAmount: discount_amount_float,
- DocumentDate: startTime,
- DeliveryDate: endTime,
- SupplierId: supplier_id,
- Mtime: time.Now().Unix(),
- }
- service.ModefySupplyWarehouseInfo(warehousing_id, info)
- dataBody := make(map[string]interface{}, 0)
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
- if err != nil {
- utils.ErrorLog(err.Error())
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- var warehousingInfo []*models.SupplierWarehousingInfoOrder
- var updateWarehousingInfo []*models.SupplierWarehousingInfoOrder
- if dataBody["stockIn"] != nil && reflect.TypeOf(dataBody["stockIn"]).String() == "[]interface {}" {
- thisStockIn, _ := dataBody["stockIn"].([]interface{})
- if len(thisStockIn) > 0 {
- for _, item := range thisStockIn {
- items := item.(map[string]interface{})
-
- if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
- utils.ErrorLog("id")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- id := int64(items["id"].(float64))
-
- if items["project_id"] == nil || reflect.TypeOf(items["project_id"]).String() != "float64" {
- utils.ErrorLog("project_id")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- project_id := int64(items["project_id"].(float64))
-
- if items["supply_count"] == nil || reflect.TypeOf(items["supply_count"]).String() != "float64" {
- utils.ErrorLog("supply_count")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- supply_count := int64(items["supply_count"].(float64))
-
- if items["supply_license_number"] == nil || reflect.TypeOf(items["supply_license_number"]).String() != "string" {
- utils.ErrorLog("supply_license_number")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_license_number := items["supply_license_number"].(string)
-
- if items["supply_price"] == nil || reflect.TypeOf(items["supply_price"]).String() != "string" {
- utils.ErrorLog("supply_price")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- supply_price := items["supply_price"].(string)
-
- supply_price_float, _ := strconv.ParseFloat(supply_price, 64)
-
- if items["supply_remake"] == nil || reflect.TypeOf(items["supply_remake"]).String() != "string" {
- utils.ErrorLog("supply_remake")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_remake := items["supply_remake"].(string)
-
- if items["supply_total_price"] == nil || reflect.TypeOf(items["supply_total_price"]).String() != "string" {
- utils.ErrorLog("supply_total_price")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- supply_total_price := items["supply_total_price"].(string)
-
- supply_total_price_float, _ := strconv.ParseFloat(supply_total_price, 64)
- if items["type"] == nil || reflect.TypeOf(items["type"]).String() != "float64" {
- utils.ErrorLog("type")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- is_source := int64(items["type"].(float64))
-
- if items["supply_type"] == nil || reflect.TypeOf(items["supply_type"]).String() != "string" {
- utils.ErrorLog("supply_type")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_type := items["supply_type"].(string)
-
- if items["supply_specification_name"] == nil || reflect.TypeOf(items["supply_specification_name"]).String() != "string" {
- utils.ErrorLog("supply_specification_name")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_specification_name := items["supply_specification_name"].(string)
-
- if items["supply_total"] == nil || reflect.TypeOf(items["supply_total"]).String() != "string" {
- utils.ErrorLog("supply_total")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_total := items["supply_total"].(string)
-
- if items["supply_manufacturer"] == nil || reflect.TypeOf(items["supply_manufacturer"]).String() != "string" {
- utils.ErrorLog("supply_manufacturer")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_manufacturer := items["supply_manufacturer"].(string)
-
- if items["name"] == nil || reflect.TypeOf(items["name"]).String() != "string" {
- utils.ErrorLog("name")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- name := items["name"].(string)
-
- if items["supply_unit"] == nil || reflect.TypeOf(items["supply_unit"]).String() != "string" {
- utils.ErrorLog("supply_unit")
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
-
- supply_unit := items["supply_unit"].(string)
- if id > 0 {
- order := models.SupplierWarehousingInfoOrder{
- ID: id,
- IsSource: is_source,
- Count: supply_count,
- Price: supply_price_float,
- Amount: supply_total_price_float,
- Remark: supply_remake,
- Ctime: time.Now().Unix(),
- Status: 1,
- Mtime: 0,
- ProjectId: project_id,
- SupplyLicenseNumber: supply_license_number,
- SupplyType: supply_type,
- SupplySpecificationName: supply_specification_name,
- SupplyTotal: supply_total,
- SupplyManufacturer: supply_manufacturer,
- Name: name,
- SupplyUnit: supply_unit,
- }
-
- updateWarehousingInfo = append(updateWarehousingInfo, &order)
- }
-
- if id == 0 {
-
- order := models.SupplierWarehousingInfoOrder{
- OrderNumber: number,
- IsSource: is_source,
- Count: supply_count,
- Price: supply_price_float,
- Amount: supply_total_price_float,
- Remark: supply_remake,
- UserOrgId: orgId,
- Ctime: time.Now().Unix(),
- Status: 1,
- Mtime: 0,
- WarehousingId: warehousing_id,
- ProjectId: project_id,
- SupplyLicenseNumber: supply_license_number,
- SupplyType: supply_type,
- SupplySpecificationName: supply_specification_name,
- SupplyTotal: supply_total,
- SupplyManufacturer: supply_manufacturer,
- Name: name,
- SupplyUnit: supply_unit,
- }
- warehousingInfo = append(warehousingInfo, &order)
- }
-
- }
- }
- if len(warehousingInfo) > 0 {
- for _, item := range warehousingInfo {
- service.CreateSupplyWarehousingOrder(item)
- }
-
- }
- if len(updateWarehousingInfo) > 0 {
- for _, item := range updateWarehousingInfo {
- service.ModifySupplyWarehouseOrder(item)
- }
-
- }
- this.ServeSuccessJSON(map[string]interface{}{
- "warehousingInfo": warehousingInfo,
- })
-
- }
- }
-
- func (this *SupplyOrderApiController) UpdateSupplyWaresing() {
-
- id, _ := this.GetInt64("id")
- recordDateStr := time.Now().Format("2006-01-02")
- recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
-
- record_date := recordDate.Unix()
- checker := this.GetAdminUserInfo().AdminUser.Id
- info := models.SupplierWarehouseInfo{
- Mtime: time.Now().Unix(),
- Status: 1,
- IsCheck: 1,
- Checker: checker,
- CheckTime: record_date,
- }
- parseDateErr := service.UpdateSupplyWaresing(id, info)
- if parseDateErr == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "info": info,
- })
- } else {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (this *SupplyOrderApiController) GetPurchaseOrderDetail() {
-
- id, _ := this.GetInt64("id")
- info, _ := service.GetPurchaseOrderDetail(id)
- //查询
- orderInfo, err := service.GetSupplyWarehousingOrderInfo(id)
- orgId := this.GetAdminUserInfo().CurrentOrgId
- supplyList, _ := service.GetSupplierList(orgId)
- //获取药品库数据
- baseList, _ := service.GetSupplyDrugList(orgId)
-
- goodList, _ := service.GetSupplyGoodList(orgId)
- if err == nil {
- this.ServeSuccessJSON(map[string]interface{}{
- "info": info,
- "orderInfo": orderInfo,
- "supplyList": supplyList,
- "baseList": baseList,
- "goodList": goodList,
- })
- } else {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
- }
- }
-
- func (this *SupplyOrderApiController) AddGoodOrder() {
-
- supplier_id, _ := this.GetInt64("supplier_id")
- start_time := this.GetString("start")
- timeLayout := "2006-01-02"
- loc, _ := time.LoadLocation("Local")
- var startTime int64
- if len(start_time) > 0 {
- theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)
- if err != nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
- return
- }
- startTime = theTime.Unix()
- }
- good_number := this.GetString("good_number")
- arrerage, _ := this.GetInt64("arrerage")
- payment, _ := this.GetInt64("payment")
- warehousing_id, _ := this.GetInt64("warehousing_id")
- number := this.GetString("number")
- rate_of_concession, _ := this.GetInt64("rate_of_concession")
- discount_amount, _ := this.GetInt64("discount_amount")
- fmt.Println(supplier_id, startTime, good_number, arrerage, payment, warehousing_id, number, rate_of_concession, discount_amount)
- }
|